SQLCA fields

The fields in the SQLCA have the following meanings:

  • sqlcaid   An 8-byte character field that contains the string SQLCA as an identification of the SQLCA structure. This field helps in debugging when you are looking at memory contents.

  • sqlcabc   A 32-bit integer that contains the length of the SQLCA structure (136 bytes).

  • sqlcode   A 32-bit integer that specifies the error code when the database detects an error on a request. Definitions for the error codes can be found in the header file sqlerr.h. The error code is 0 (zero) for a successful operation, positive for a warning, and negative for an error.

  • sqlerrml   The length of the information in the sqlerrmc field.

  • sqlerrmc   Zero or more character strings to be inserted into an error message. Some error messages contain one or more placeholder strings (%1, %2, ...) that are replaced with the strings in this field.

    For example, if a Table Not Found error is generated, sqlerrmc contains the table name, which is inserted into the error message at the appropriate place.

  • sqlerrp   Reserved.

  • sqlerrd   A utility array of 32-bit integers.

  • sqlwarn   Reserved.

  • sqlstate   The SQLSTATE status value. The ANSI SQL standard defines this type of return value from a SQL statement in addition to the SQLCODE value. The SQLSTATE value is always a five-character null-terminated string, divided into a two-character class (the first two characters) and a three-character subclass. Each character can be a digit from 0 through 9 or an uppercase alphabetic character A through Z.

    Any class or subclass that begins with 0 through 4 or A through H is defined by the SQL standard; other classes and subclasses are implementation defined. The SQLSTATE value '00000' means that there has been no error or warning.

 sqlerror array
 See also