PREPARE stmt AS result of Concat in PostgreSQL

by Ugy Astro   Last Updated March 13, 2018 07:06 AM

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:




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;*/


But I always get an error :

ERROR:  syntax error at or near "A"
LINE 85:  PREPARE stmt AS A;

My questions are :

  1. How can I access the variable A so it can run normally?
  2. With or without PREPARE, is there any different of result when we run the query? If use PREPARE what is the advantages? Thanks expert!

Related Questions

Conditional string concatenation in PostgreSQL

Updated May 03, 2018 08:06 AM

migrating from Postgres to MonetDB

Updated March 26, 2015 09:02 AM