MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Equivalent of to_char in DB2

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
vani
Beginner


Joined: 28 May 2003
Posts: 51
Topics: 30

PostPosted: Mon Nov 24, 2003 5:15 am    Post subject: Equivalent of to_char in DB2 Reply with quote

I need to know if it is possible to change a numeric result within a select statement into a character format.

INSERT INTO SESSION.ATABTXT (asatzart, asaih, atext)
SELECT '0005',
MWSTID,
MWSTBEZ
FROM VMWST;
SqlError(SQLCODE,540);
/*???ASAIH IS CHAR(4) AND MWSTID IS SMALL INT*/

Can we change the format of MWSTID from NUMERIC to CHARACTER within the select statement ?
(I understand that it is possible in oracle by using tochar function)
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Nov 24, 2003 6:15 am    Post subject: Reply with quote

vani,

Use the scalar function DIGITS which will return a character string representation numeric data type of SMALLINT, INTEGER, or DECIMAL.

Check this link for a detailed explanation of DIGITS

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/3.2.27?SHELF=&DT=20010718164132&CASE=

Hope this helps...

cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nivedita
Beginner


Joined: 04 Nov 2003
Posts: 22
Topics: 15

PostPosted: Tue Nov 25, 2003 11:39 pm    Post subject: Reply with quote

Thanks It worked!!!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group