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
 

 

Why we need SQLSTATE in the SQLCA

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
pjnithin

Active User


Joined: 22 Dec 2005
Posts: 116

PostPosted: Wed Jun 13, 2007 11:34 am    Post subject: Why we need SQLSTATE in the SQLCA
Reply with quote

Hi,
I would like to know why we need SQLSTATE in the SQLCA when we already have an SQLCODE which give us the details about query just execyted. I know the difference between SQLCODE and SQLSTATE, but wolud like to know why both are present in SQLCA when the SQLCODES are mapped to SQLSTATEs itself.
Thanks,
Nithin.
Back to top
View user's profile Send private message

Santoshdorge

New User


Joined: 27 Jun 2006
Posts: 48
Location: Pune

PostPosted: Wed Jun 13, 2007 12:13 pm    Post subject:
Reply with quote

Hi,
Sqlcode is platform dependant where as sqlstate is platform independant
there are around 1000 predefined sqlcodes and 75000 sqlstates in db2.
As sqlcode is defined as s9(9) comp-4 processing would be fast compared to sqlstate x(5)

thanks,
Santosh.
Back to top
View user's profile Send private message
pjnithin

Active User


Joined: 22 Dec 2005
Posts: 116

PostPosted: Wed Jun 13, 2007 1:31 pm    Post subject: Re: SQLCODE and SQLSTATE
Reply with quote

Yes, this part I know.
But why we need both present in SQLCA when SQLCODE itself is enuf to know what caused an error in DB2.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jun 13, 2007 11:47 pm    Post subject:
Reply with quote

Hello,

If we are going to use the product, we're stuck with the vendor's design.

If you prefer, you don't have to use the data if you don't want to.
Back to top
View user's profile Send private message
pjnithin

Active User


Joined: 22 Dec 2005
Posts: 116

PostPosted: Thu Jun 14, 2007 11:06 am    Post subject: Re: Why we need SQLSTATE in the SQLCA
Reply with quote

This question was asked to me in an interview. Just wondering since we have only 1000 SQLCODEs compared to 75000 SQLSTATEs, is it the reason we have included SQLSTATEs also in the query, since some of SQLSTATEs may not having a SQLCODE mapped to it.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 SQL Error: SQLCODE=-440, SQLSTATE... kishpra DB2 1 Sat Feb 18, 2017 2:31 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 6 Thu Oct 27, 2016 10:20 am
No new posts SQLSTATE=22001 while trying to load d... pramod.raghuwanshi ABENDS & Debugging 6 Mon May 13, 2013 3:54 pm
No new posts SQLCODE = -20100 SQLSTATE = 56059 T... Heindba DB2 5 Mon Apr 29, 2013 7:19 pm
No new posts DB2 error "SQLCA" WAS NOT D... Kalyan Padigala ABENDS & Debugging 6 Wed Mar 14, 2012 9:15 pm


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