Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Adding column data in db2 sql query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Anamikaa

New User


Joined: 13 Apr 2010
Posts: 2
Location: SanDiego,USA

PostPosted: Wed Jun 16, 2010 1:27 am    Post subject: Adding column data in db2 sql query
Reply with quote

Hi! There are two decimal data columns in a DB2 table.
Col 1 is Decimal(5,0) and col2 is decimal(5,0).
I want to add both these column datas in my sql query.
Can you please help.

ex.

SELECT COL1,COL2, COL1+COL2 FROM TABLE
Back to top
View user's profile Send private message

Anamikaa

New User


Joined: 13 Apr 2010
Posts: 2
Location: SanDiego,USA

PostPosted: Wed Jun 16, 2010 1:29 am    Post subject:
Reply with quote

I tried to use digits( function. I didn't get any SQL error.
But the result is not getting displayed
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jun 16, 2010 1:34 am    Post subject:
Reply with quote

col1 + col2 works fine for me.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Wed Jun 16, 2010 1:35 am    Post subject: Reply to: Adding column data in db2 sql query
Reply with quote

anything wrong in looking at the manuals icon_question.gif


http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/DSNSHKA3
for the full shebang

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQK15/CCONTENTS?SHELF=DSNSHKA3&DN=SC18-9854-05&DT=20081120084907
for the sql reference

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQK15/2.22?SHELF=DSNSHKA3&DT=20081120084907
for expressions

faster than asking on a forum..
remember... searching for it Yourself will help You to remember better about it
Back to top
View user's profile Send private message
cmsmoon

New User


Joined: 17 Jun 2010
Posts: 75
Location: Chennai

PostPosted: Fri Jun 18, 2010 10:17 pm    Post subject: Reply to: Adding column data in db2 sql query
Reply with quote

i think it is working for numerica data...


select col,col2,col1 + col2 from table
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Jun 18, 2010 10:23 pm    Post subject: Re: Reply to: Adding column data in db2 sql query
Reply with quote

cmsmoon wrote:
i think it is working for numerica data...


select col,col2,col1 + col2 from table


Addition is not defined for nonnumeric data!!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us