问题
I want to assign multiple values or string or their combination to a postgresql variable. What I want to achieve is something like this done in DB2:
STRING '(' DELIMITED BY SIZE
variable_1 DELIMITED BY SPACE
' ' DELIMITED BY SIZE
variable_2
DELIMITED BY SIZE
variable_3 DELIMITED BY SIZE
' ) ' DELIMITED BY SIZE
X'10' DELIMITED BY SIZE
INTO var_string
END-STRING
In the same way i have some variables and string which I want to add in a variable "var_string". Is it possible?
回答1:
Try CONCAT Function
DECLARE var_string varchar;
var_string:= concat(variable_1, variable_2,variable_3);
来源:https://stackoverflow.com/questions/48540432/how-to-assign-multiple-variable-and-string-in-a-variable-in-postgresql