can't create stored procedure for postgresql db

[expired user #10621]'s profile image [expired user #10621] posted 7 years ago in Running SQL scripts Permalink

when create procedure for postgresql

CREATE OR REPLACE FUNCTION func_test(code integer) RETURNS INTEGER AS $$

BEGIN

return 1;

END; $$ LANGUAGE plpgsql;

1 attachment(s):
  • HeidiSQL_9.4_ERROR
ansgar's profile image ansgar posted 7 years ago Permalink

You are using semicolon in the procedure code itself, and HeidiSQL splits queries at these places. So you are actually executing the code up to and including "return 1". You need to add such a line above the whole query:

DELIMITER //
CREATE OR REPLACE ...

Don't forget to reset the delimiter afterwards:

DELIMITER ;

Please login to leave a reply, or register at first.