Use concat and maintain length of variable

Posted by user1682055 on Stack Overflow See other posts from Stack Overflow or by user1682055
Published on 2012-10-04T03:18:02Z Indexed on 2012/10/04 3:37 UTC
Read the original article Hit count: 170

Filed under:
|
|

I'm trying to use concat on some variables. These variables have been declared as chars:

declare v_order_date char(10);
declare v_quantity char(11);
declare v_plant char(100);

I have a cursor where I am setting these as some outputs. To call the results, I am setting v_msg as

set v_msg := concat( v_msg, '\n', v_order_date, v_quantity, v_plant);

However, the result I am getting when I select v_msg is:

2012-01-222501008 Creeping Buttercup

but I want to maintain the length of the declared variables in my select that looks like this

2012-01-22  250    1008    Creeping Buttercup

Are there any suggestions? Thank you.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about concat