"Kevin Nikiforuk" <[EMAIL PROTECTED]> writes: > CREATE OR REPLACE FUNCTION rgio() RETURNS integer as $$ > BEGIN > DECLARE lv RECORD; > FOR lv IN SELECT DISTINCT rg FROM ldevrg LOOP > SELECT ldev FROM ldevrg WHERE ldevrg='$lv'; > END LOOP; > RETURN 1; > END; > $$ LANGUAGE plpgsql;
You've got a small error in the layout: the DECLARE part goes before BEGIN not after. Swap the first two lines of the function. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org