Merge a string into a statement that assigns a variable in PostgreSQL

I am trying to convert a SQL Server procedure to PostgreSQL.

In a SQL Server procedure, the following instructions exist.

SET @val = '(' + @someval + ')'

So in postgresql I wrote as below

SET val = '(' || someval || ')';

But the above statement gives an error with ||

Any body can tell me where I am making a mistake.

+4
source share
1 answer

AFAIK, the PostgreSQL SET statement used to change settings , to assign variables just use :=:

val := '(' || someval || ')';

sql

+5
source

All Articles