View previous topic :: View next topic
|
Author |
Message |
pjnithin
Active User
Joined: 22 Dec 2005 Posts: 116
|
|
|
|
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 |
|
|
Santoshdorge
New User
Joined: 27 Jun 2006 Posts: 48 Location: Pune
|
|
|
|
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 |
|
|
pjnithin
Active User
Joined: 22 Dec 2005 Posts: 116
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
pjnithin
Active User
Joined: 22 Dec 2005 Posts: 116
|
|
|
|
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 |
|
|
|