SQL Reference

SQLCA Field Descriptions


Table 35. Fields of SQLCA
Name110 Data Type Field Values
sqlcaid CHAR(8) An "eye catcher" for storage dumps containing 'SQLCA'. The sixth byte is 'L' if line number information is returned from parsing an SQL procedure body.
sqlcabc INTEGER Contains the length of the SQLCA, 136.
sqlcode INTEGER Contains the SQL return code. For specific meanings of SQL return codes, see the message section of the Message Reference.
Code
Means
0
Successful execution (although one or more SQLWARN indicators may be set).
positive
Successful execution, but with a warning condition.
negative
Error condition.
sqlerrml SMALLINT Length indicator for sqlerrmc, in the range 0 through 70. 0 means that the value of sqlerrmc is not relevant.
sqlerrmc VARCHAR (70) Contains one or more tokens, separated by X'FF', that are substituted for variables in the descriptions of error conditions.

This field is also used when a successful connection is completed.

When a NOT ATOMIC compound SQL statement is issued, it may contain information on up to 7 errors.

For specific meanings of SQL return codes, see the message section of the Message Reference.

sqlerrp CHAR(8) Begins with a three-letter identifier indicating the product, followed by five digits indicating the version, release, and modification level of the product. For example, SQL07010 means DB2 Universal Database Version 7 Release 1 Modification level 0.

If SQLCODE indicates an error condition, then this field identifies the module that returned the error.

This field is also used when a successful connection is completed.

sqlerrd ARRAY Six INTEGER variables that provide diagnostic information. These values are generally empty if there are no errors, except for sqlerrd(6) from a partitioned database.
sqlerrd(1) INTEGER If connection is invoked and successful, contains the maximum expected difference in length of mixed character data (CHAR data types) when converted to the database code page from the application code page. A value of 0 or 1 indicates no expansion; a value greater than 1 indicates a possible expansion in length; a negative value indicates a possible contraction. a

On successful return from an SQL procedure, contains the return status value from the SQL procedure.

sqlerrd(2) INTEGER

If connection is invoked and successful, contains the maximum expected difference in length of mixed character data (CHAR data types) when converted to the application code page from the database code page. A value of 0 or 1 indicates no expansion; a value greater than 1 indicates a possible expansion in length; a negative value indicates a possible contraction. a If the SQLCA results from a NOT ATOMIC compound SQL statement that encountered one or more errors, the value is set to the number of statements that failed.

sqlerrd(3) INTEGER

If PREPARE is invoked and successful, contains an estimate of the number of rows that will be returned. After INSERT, UPDATE, and DELETE, contains the actual number of rows affected. If compound SQL is invoked, contains an accumulation of all sub-statement rows. If CONNECT is invoked, contains 1 if the database can be updated; 2 if the database is read only.

If CREATE PROCEDURE for an SQL procedure is invoked and an error is encountered parsing the SQL procedure body, contains the line number where the error was encountered. The sixth byte of sqlcaid must be 'L' for this to be a valid line number.

sqlerrd(4) INTEGER

If PREPARE is invoked and successful, contains a relative cost estimate of the resources required to process the statement. If compound SQL is invoked, contains a count of the number of successful sub-statements. If CONNECT is invoked, contains 0 for a one-phase commit from a down-level client; 1 for a one-phase commit; 2 for a one-phase, read-only commit; and 3 for a two-phase commit.

sqlerrd(5) INTEGER

Contains the total number of rows deleted, inserted, or updated as a result of both:

  • The enforcement of constraints after a successful delete operation
  • The processing of triggered SQL statements from activated triggers.

If compound SQL is invoked, contains an accumulation of the number of such rows for all substatements. In some cases when an error is encountered, this field contains a negative value that is an internal error pointer. If CONNECT is invoked, contains an authentication type value of 0 for a server authentication; 1 for client authentication; 2 for authentication using DB2 Connect; 3 for DCE security services authentication; 255 for unspecified authentication.

sqlerrd(6) INTEGER

For a partitioned database, contains the partition number of the partition that encountered the error or warning. If no errors or warnings were encountered, this field contains the partition number of the coordinator node. The number in this field is the same as that specified for the partition in the db2nodes.cfg file.

sqlwarn Array A set of warning indicators, each containing a blank or W. If compound SQL is invoked, contains an accumulation of the warning indicators set for all substatements.
sqlwarn0 CHAR(1) Blank if all other indicators are blank; contains W if at least one other indicator is not blank.
sqlwarn1 CHAR(1) Contains W if the value of a string column was truncated when assigned to a host variable. Contains N if the null terminator was truncated.

Contains A if the CONNECT or ATTACH is successful and the authID for the connection is longer than 8 bytes.

sqlwarn2 CHAR(1) Contains W if null values were eliminated from the argument of a function. b
sqlwarn3 CHAR(1) Contains W if the number of columns is not equal to the number of host variables.
sqlwarn4 CHAR(1) Contains W if a prepared UPDATE or DELETE statement does not include a WHERE clause.
sqlwarn5 CHAR(1) Reserved for future use.
sqlwarn6 CHAR(1) Contains W if the result of a date calculation was adjusted to avoid an impossible date.
sqlwarn7 CHAR(1) Reserved for future use.

If CONNECT is invoked and successful, contains 'E' if the DYN_QUERY_MGMT database configuration parameter is enabled.

sqlwarn8 CHAR(1) Contains W if a character that could not be converted was replaced with a substitution character.
sqlwarn9 CHAR(1) Contains W if arithmetic expressions with errors were ignored during column function processing.
sqlwarn10 CHAR(1) Contains W if there was a conversion error when converting a character data value in one of the fields in the SQLCA.
sqlstate CHAR(5) A return code that indicates the outcome of the most recently executed SQL statement.
Note:

a
See the "Character Conversion Expansion Factor" section of the "Programming in Complex Environments" chapter in the Application Development Guide for details.

b
Some functions may not set SQLWARN2 to W even though null values were eliminated because the result was not dependent on the elimination of null values.

Related Information:


[ Top of Page | Previous Page | Next Page ]