1

I have a Postgres database that I connect to using SQL Squirrel (which under hood uses the postgres jdbc driver).

When I run the following statement (which is valid sql, copied directly from this page)

CREATE PROCEDURE insert_data(a integer, b integer)
LANGUAGE SQL
AS $$
INSERT INTO tbl VALUES (a);
INSERT INTO tbl VALUES (b);
$$;

CALL insert_data(1, 2);

I get the following error

Error: Unterminated dollar quote started at position 67 in SQL CREATE PROCEDURE insert_data(a integer, b integer)
LANGUAGE SQL
AS $$
INSERT INTO tbl VALUES (a). Expected terminating $$
SQLState:  42601
ErrorCode: 0
Error occurred in:
CREATE PROCEDURE insert_data(a integer, b integer)
LANGUAGE SQL
AS $$
INSERT INTO tbl VALUES (a)

It seems that somewhere along the way the first semicolon is being interpreted as the end of the statement.

Is there some way to escape the semicolon, so that the procedure gets created correctly?

Please don't suggest using psql, I want to keep using SQL Squirrel.

ThatDataGuy
  • 1,969
  • 2
  • 17
  • 43

0 Answers0