I'm sorry if this issue is so simple. I have some query that can run normally in MySQL Stored Procedure. But now I'm migrating it to PostgreSQL, that query is result of Concat from another query. The query simply like this:
DECLARE
A TEXT;
BEGIN
A = concate(sql); /*in MySQL I just use SET A = CONCATE(sql)*/
PREPARE stmt AS A; /* in MySQL normally run with PREPARE stmt FROM A;*/
EXECUTE stmt;
END
But I always get an error :
ERROR: syntax error at or near "A"
LINE 85: PREPARE stmt AS A;
My questions are :
- How can I access the variable
A
so it can run normally? - With or without
PREPARE
, is there any different of result when we run the query? If usePREPARE
what is the advantages?
Thanks expert!