I have to write a function in PLPGSQL but I have problem with the function body quoted with dollar-quoting. Using the first tutorial:
CREATE FUNCTION inc(val integer)
RETURNS integer AS
$BODY$
BEGIN
RETURN val + 1;
END;
$BODY$
LANGUAGE PLPGSQL;
I get an error:
unterminated dollar-quoted string at or near $$
Searching on google I just found it's a JDBC Driver problem but I cannot update it.
So I have tried to change the DELIMITER
to remove $$
:
DELIMITER ++;
CREATE FUNCTION inc(val integer)
RETURNS integer AS
++BODY++
BEGIN
RETURN val + 1;
END;
++BODY++
LANGUAGE PLPGSQL;
DELIMITER ;
The command doesn't return any error but function doesn't exists when I try to call it:
select inc(4);
What am I missing?