IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Why we need SQLSTATE in the SQLCA


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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
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
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

Moderator Emeritus


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

PostPosted: Wed Jun 13, 2007 11:47 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts SQLCODE=-204 SQLSTATE=42704 DB2 4
No new posts I need help with SQLCA DB2 8
No new posts Confusion regarding length of SQLCA v... DB2 4
No new posts How to fix SQLCODE=-440, SQLSTATE=42884 DB2 1
No new posts Access SQLCA fields inside a stored p... DB2 6
Search our Forums:

Back to Top