SQLSTATE: Difference between revisions

Content deleted Content added
Kelti (talk | contribs)
Adding the complete list of values
Kelti (talk | contribs)
Incorrect and missleading use of the term 'SQLCODE'
Line 1:
Programs calling a database which accords to the SQL standard receive an indication about the success or failure of the call. This return code - which is called SQLSTATE - consists of 5 byte. They are divided into two parts: the first and second byte contains a '''class''' and the following three a '''subclass'''. Each class belongs to one of four '''categories''': "S" denotes "Success" (class 00), "W" denotes "Warning" (class 01), "N" denotes "No data" (class 02) and "X" denotes "Exception" (all other classes).
 
* Real DBMS mayare free to define additional values for SQLCODESQLSTATE to handle those features which are beyond the standard. Such implementation dependent values must containuse one of the characters [I-Z] or [5-9] inas the first byte of class (1. byte of SQLSTATE) or subclass (3. byte of SQLSTATE).
* In addition to SQLCODESQLSTATE the SQL command <code>GET DIAGNOSTICS</code> offers more details about the last executed SQL command.
* In very early versions of the SQL standard the return code was called SQLCODE and used a different coding schema.
 
Line 8:
 
{|class="wikitable"
! SQLSTATE !!Cat.!!Class!! style="text-align:left" | Class Text !!Subclass!! style="text-align:left" | Subclass Text !! SQL part
|-
| 00000 || S || 00 || successful completion || 000 || (no subclass) ||