Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to fix the issue for SQLCODE -802 and sqlstate 22003

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

New User


Joined: 05 Dec 2007
Posts: 29
Location: Bangalore

PostPosted: Tue Sep 07, 2010 5:41 pm    Post subject: How to fix the issue for SQLCODE -802 and sqlstate 22003
Reply with quote

HI,
I have a column COL_A in DB2 which is defined as INTEGER of length(4). I want to run follwoing query to get the sum of this column( amount). Eg:

Select sum(Col_A) from tab_A

If i ran the same query which have less data, its working fine but if I tried to run this query which have huge no of rows, I am getting
SQLCODE =-802 and SQLstate= 22003.

Looks like, the output results exceed the boundary of bytes that a integer field can hold. Is there any other way to fix this issue without changing the fields attributes of Col_A.

Thanks in advance
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue Sep 07, 2010 5:48 pm    Post subject:
Reply with quote

Quote:
...defined as INTEGER of length(4)...


why do posters try to impress us with their wealth of knowledge
when it is just useless facts?

the number of bytes a column contains is only worthwhile consideration when referring to character data.
numeric data types require knowledge of capacity - max value.

have not tested it, but it would seem to me that if you were to CAST COL_A as BIG INTEGER and then SUM, it may work.
Back to top
View user's profile Send private message
Khwairakpam Raju Singh

New User


Joined: 05 Dec 2007
Posts: 29
Location: Bangalore

PostPosted: Tue Sep 07, 2010 6:22 pm    Post subject: Reply to: How to fix the issue for SQLCODE -802 and sqlstate
Reply with quote

Wow its working with

Select sum(cast((Col_A) as dec(16,2))) from Tab_A

Dick, thanks a lot for your help :-)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue Sep 07, 2010 6:29 pm    Post subject:
Reply with quote

glad you were able to overlook my criticism and find a workable solution.
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 Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts DB2 SQL Error: SQLCODE=-440, SQLSTATE... kishpra DB2 1 Sat Feb 18, 2017 2:31 am
No new posts Execessive parameter issue Sumeendar JCL & VSAM 5 Mon Dec 19, 2016 4:35 pm
No new posts DFHRESPONSE returns issue divated CICS 3 Wed Nov 02, 2016 6:32 pm
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us