Go Back   Rhinocerus > Newsgroup > Newsgroup comp.databases.* > Newsgroup comp.databases.informix

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 08-16-2012, 11:04 AM
joe
Guest
 
Posts: n/a
Default format data in stored procedure

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 ?
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 08-16-2012, 02:53 PM
Jonathan Leffler
Guest
 
Posts: n/a
Default Re: format data 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."

Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 02:13 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.