Reputation: 97
CREATE OR REPLACE FUNCTION f_sync_from_xml()
RETURNS boolean AS
$BODY$
DECLARE
myxml xml;
datafile text := 'path/to/my_file.xml';
BEGIN
myxml := pg_read_file(datafile, 0, 100000000);
This function returns error
ERROR: unterminated dollar-quoted string at or near "$BODY$
. How do I solve it?
Upvotes: 0
Views: 126
Reputation: 51609
the definition is not completed, yo uneed to terminate it, eg:
CREATE OR REPLACE FUNCTION f_sync_from_xml()
RETURNS boolean AS
$BODY$
DECLARE
myxml xml;
datafile text := 'path/to/my_file.xml';
BEGIN
myxml := pg_read_file(datafile, 0, 100000000);
END;
$BODY$ language plpgsql;
here $BODY$
is a safe quote - function definition remains inside quotes
Upvotes: 2