简体   繁体   中英

How to assign multiple variable and string in a variable in postgresql

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?

Try CONCAT Function

 DECLARE var_string varchar;
 var_string:= concat(variable_1, variable_2,variable_3);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM