Hi All,
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;
IF xcount = 0 THEN
RAISE DEBUG 'LID=% not found', lid;
nid := -99;
RETURN
END IF
......
The exact error message is:
ERROR: syntax error at or near "xcount" at character
I am must be doing something wrong somewhere.
Thanks a lot for any help.
_C_