Working Example CREATE OR REPLACE FUNCTION test() RETURNS VOID AS $$ DECLARE _record RECORD; BEGIN FOR _record IN SELECT column1 FROM table1 LOOP -- END LOOP; END; $$ LANGUAGE 'plpgsql'; Not working Example (only by adding AS alias to the table) CREATE OR REPLACE FUNCTION test() RETURNS VOID AS $$ DECLARE _record RECORD; BEGIN FOR _record IN SELECT ppt.column1 FROM table1 AS p p t LOOP -- END LOOP; END; $$ LANGUAGE 'plpgsql' ; Syntax Error #1 Syntax error, found: '$$ DECLARE _ record R ...' at line 1, column 51 ERROR: line 1, column 51, ending line 6, column 46: Found '$$ DECLARE _record R...': Expecting: strin #2 Syntax error, found: 'pt' at line 6, column 47 ERROR: line 6, column 47, ending line 6, column 48: Found 'pt': Expecting: end-of-input a statemen #3 Syntax error, found: '$$ LANGUAGE 'plpgsql';' at line 11, column 1 ERROR: Line 11, column 1, ending line 11, column 22: Found '$$ LANGUAGE 'plpgsql';': Expecting: end-of-input a statemen Is it normal, that every error don't have the last char? System Windows 7 x64 Java 1.8.0_25-b18 Eclipse 4.4.1 TEE 2.1.1.201410301251
↧