0

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?

3
  • 1
    Are you looking for a simple concat()?, e.g.: var_string := concat(variable_1, ' ', variable_2, variable_3); Please edit your question and add some sample data and the expected output based on that data. Formatted text please, no screen shots. (do not post code or additional information in comments) Commented Jan 31, 2018 at 10:59
  • Please provide sample data and desired results. Commented Jan 31, 2018 at 11:44
  • Yes CONCAT() it is. thank you. Commented Feb 1, 2018 at 12:10

1 Answer 1

1

Try CONCAT Function

 DECLARE var_string varchar;
 var_string:= concat(variable_1, variable_2,variable_3);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.