Hi,
I am trying to figure out if I can get the line number, when executing a
"CREATE FUNCTION" statement which fails. The line number of where the
error occurs.
For example, if I execute:
CREATE OR REPLACE FUNCTION "public"."new_func" (xid, xid) RETURNS bool AS
'
BEGIN
IFsss $2 IS NULL THEN
return ''NULL'';
ELSE
return ''NOT_NULL'';
END IF;
END
' LANGUAGE 'plpgsql'
I would like to get back the line number 4, which is the line in where
the syntax error occurs. Could this be placed in the
SQLException.getMessage() text? If so, then I can parse out the line
number for my use. Otherwise, I can't find the line number anywhere.
Example: [ERROR: Line 4: syntax error at or near "ELSE"]
In PGAdmin you get the line number in the text message, but I assume it
is using the native API. In a Java Query tool which uses JDBC the line
number would be nice.
thanks
-Niels