Maybe it's not new case, but I'm stack about it. This is the procedure that I use to run query, it run normally in MySQL, but not in PostgreSQL and I don't know how to do that. The procedure(in MySQL) looks like :
CREATE PROCEDURE runstatement(IN statement TEXT)
BEGIN
SET @s = statement;
IF LENGTH(@s) <> 0 THEN PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
END
The questions:
- How do I convert it to PostgreSQL version?
- How do I call this procedure(runstatement) when I need it in another procedure? In MySQL I know as
CALL runstatement(param).
Thanks for each reply. I'm new in database programming especially PostgreSQL.