format data in stored procedure
Posted in 2012
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
I want to format data value like : let char_var = date_var using 'yy' ; ( get the year from date ) & let char_var2 = char_var1, int_var using '&&&&' ; (concatenate character and integer) These command working in 4gl program. How can I do the same job in stored procedure ?
On Thu, Aug 16, 2012 at 4:04 AM, joe <joeclhua@gmail.com> wrote: > I want to format data value like : > let char_var = date_var using 'yy' ; ( get the year from date ) > LET var_char = MOD(YEAR(date_var), 100); Beware the decade 00-09... LET var_char = YEAR(date_var); LET var_char = var_char[3,4]; Beware the millennium 0001..0999. > & > let char_var2 = char_var1, int_var using '&&&&' ; > (concatenate character and integer) > Once more, zero-fill for the '&&&&' is the tricky bit: LET char_var2 = 10000 + int_var; LET char_var2 = char_var1 || char_var[2,5]; These command working in 4gl program. > SPL != I4GL. > How can I do the same job in stored procedure? > -- Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused."