<cyw@xxxxxxx> writes: > I am getting an error on "GET DIAGNOSTICS " statement in a PL/SQL function > below. > CREATE OR REPLACE FUNCTION test(lid int, OUT nid int) AS $$ > DECLARE > road_row road%ROWTYPE; > BEGIN > SELECT * INTO road_row FROM road WHERE link_id=lid; > GET DIAGNOSTICS xcount = ROW_COUNT; You need to have declared xcount as an integer variable. > The exact error message is: > ERROR: syntax error at or near "xcount" at character Hmm, not the most friendly error, I agree ... regards, tom lane