SQL Negative Return Codes

The SQL return codes are listed here numerically, you may browse through them or you may enter the code you are looking for and press the enter key to go directly to the return code description.

The codes are broken up into numeric ranges to make the HTML documents smaller and thus load faster. They are basically divided into the groups by the hundreds digit, (ie 0-99, 100-199 and etc.). However each section has the index for all the negative return codes.

-007 -010 -029 -060 -084 -101 -102 -103 -104 -105 -107 -109 -110 -111 -112 -113 -115 -117 -118 -119 -120 -121 -122 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -136 -137 -138 -144 -150 -151 -153 -154 -156 -157 -158 -159 -160 -161 -164 -170 -171 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -191 -198 -199 -203 -204 -205 -206 -207 -208 -219 -220 -221 -250 -251 -301 -302 -303 -304 -305 -309 -311 -312 -313 -314 -330 -331 -332 -333 -401 -402 -404 -405 -406 -407 -408 -409 -410 -411 -412 -414 -415 -416 -417 -418 -419 -421 -426 -427 -501 -502 -503 -504 -507 -508 -509 -510 -511 -512 -513 -514 -516 -517 -518 -519 -525 -530 -531 -532 -533 -534 -535 -536 -537 -538 -539 -540 -542 -551 -552 -553 -554 -555 -556 -557 -558 -559 -567 -571 -601 -602 -603 -604 -607 -612 -613 -614 -615 -616 -618 -619 -620 -621 -622 -623 -624 -625 -626 -627 -628 -629 -631 -932 -633 -634 -635 -636 -637 -638 -639 -644 -646 -647 -652 -653 -660 -661 -662 -663 -665 -666 -667 -668 -669 -670 -671 -676 -677 -678 -679 -680 -681 -682 -683 -684 -685 -686 -687 -688 -689 -690 -691 -692 -693 -694 -715 -716 -717 -718 -719 -720 -721 -722 -726 -730 -731 -732 -733 -734 -735 -736 -737 -752 -802 -803 -804 -805 -807 -811 -812 -815 -817 -818 -819 -820 -822 -840 -900 -901 -902 -904 -905 -906 -907 -908 -909 -910 -911 -913 -917 -918 -922 -923 -924 -925 -926 -927 -950
-30000 -30020 -30021 -30030 -30040 -30041 -30050 -30051 -30052 -30053 -30060 -30061 -30070 -30071 -30072 -30073 -30074 -30080 -30090

SQL Code -301
THE VALUE OF INPUT HOST VARIABLE NUMBER position-number CANNOT BE USED AS SPECIFIED BECAUSE OF ITS DATA TYPE

Explanation: The input host variable in the input SQLDA whose entry number is indicated by 'position-number', could not be used as specified in the statement because its data type is incompatible with the requested function.

System Action: The statement cannot be executed.

Programmer Response: Verify that the data type of the indicated input host variable in the statement is compatible with the manner in which it is used.

SQLSTATE: 22507


SQL Code -302
THE VALUE OF INPUT VARIABLE NUMBER position-number IS INVALID OR TOO LARGE FOR THE TARGET COLUMN OR THE TARGET VALUE

Explanation: The value of the input host variable, whose entry in the input SQLDA is indicated by 'position-number', was found to be invalid or to be too large to fit in the corresponding column of the table or the corresponding target value. One of the following has occurred:

  • The column is defined as string and the host variable contains a string that is too long for the column.
  • The column is defined as numeric and the host variable contains a numeric value too large for the definition of the column.
  • The host variable is defined as decimal, but contains bad decimal data.
  • The target value is a string constant and the host variable contains a string that is too long for the target value.
  • The target value is a numeric constant and the host variable contains a numeric value that is too large for the target value.

System Action: The statement cannot be executed.

Programmer Response: Correct the application program. Check the column type and length of the value or the data type and contents of input host variable 'position-number'. Ensure that the value of the host variable will fit in the column or contains valid decimal data. Valid decimal data is a System/370 packed decimal number.

SQLSTATE: 22001


SQL Code -303
A VALUE CANNOT BE ASSIGNED TO OUTPUT HOST VARIABLE NUMBER position-number BECAUSE THE DATA TYPES ARE NOT COMPARABLE

Explanation: A FETCH or SELECT into the output host variable, whose entry in the output SQLDA is indicated by 'position-number', could not be performed because the data type of the variable was not compatible with the data type of the corresponding SELECT-list element. The output host variable and the corresponding SELECT-list element must fall in one of the following categories:

  • Both values must be numbers.
  • Both values must be character strings.
  • Both values must be graphic strings.

In addition, for datetime, and timestamp values, the host variable must be a character string variable with a proper length.

System Action: The FETCH or SELECT cannot be executed. No data was retrieved.

Programmer Response: Verify that table definitions are current, and that the host variable has the proper data type.

SQLSTATE: 22509


SQL Code -304
A VALUE WITH DATA TYPE data-type1 CANNOT BE ASSIGNED TO A HOST VARIABLE BECAUSE THE VALUE IS NOT WITHIN THE RANGE OF THE HOST VARIABLE IN POSITION position-number WITH DATA TYPE data-type2

Explanation: A FETCH or SELECT into a host variable list or structure, position number 'position-number' failed because the host variable having data type 'data-type2' was not large enough to hold the retrieved value having data type 'data-type1'.

System Action: The statement cannot be executed. No data was retrieved. If the statement was a FETCH then the CURSOR remains open.

Programmer Response: Verify that table definitions are current, and that the host variable has the proper data type. See the explanation for SQLCODE -405 for ranges of SQL data types.

SQLSTATE: 22003


SQL Code -305
THE NULL VALUE CANNOT BE ASSIGNED TO OUTPUT HOST VARIABLE NUMBER position-number BECAUSE NO INDICATOR VARIABLE IS SPECIFIED

Explanation: A FETCH or embedded SELECT operation resulted in the retrieval of a null value to be inserted into the output host variable, designated by entry number 'position-number' of the output SQLDA, for which no indicator variable was provided. An indicator variable must be supplied if a col

umn returns a null value.

System Action: The statement cannot be executed. No data was retrieved.

Programmer Response: Examine the definition of the table that is the object of the FETCH or SELECT, and correct the application program to provide indicator variables for all host variables into which null values can be retrieved. This includes host variables for columns which can contain null values and host variables which receive the results of column functions whose result table could be empty.

SQLSTATE: 22002


SQL Code -309
A PREDICATE IS INVALID BECAUSE A REFERENCED HOST VARIABLE HAS THE NULL VALUE

Explanation: The statement could not be processed because a host variable appearing in a predicate such as
column-name = host-variable
had the NULL value. Such a predicate is not permitted in the case in which the host variable contains the NULL value--even though the object column may in fact contain nulls.

System Action: The statement cannot be executed.

Programmer Response: Rebind the plan or package containing the statement. The condition described is not an error in DB2 Version 2 Release 3 and later.

SQLSTATE: 22512


SQL Code -311
THE LENGTH OF INPUT HOST VARIABLE NUMBER position-number IS NEGATIVE OR GREATER THAN THE MAXIMUM

Explanation: When evaluated, the length specification for input host string variable, whose entry in the SQLDA is indicated by position-number, was negative or greater than the maximum.

System Action: The statement cannot be executed.

Programmer Response: Correct the program to ensure that the lengths of all host string variables are not negative or that they are not greater than the maximum allowed length.

SQLSTATE: 22501


SQL Code -312
UNDEFINED OR UNUSABLE HOST VARIABLE variable-name

Explanation: The host variable 'variable-name' appears in the SQL statement, but either no declaration for a variable of that name appears in the application program, or the attributes are improper for the specified usage.

System Action: The statement cannot be executed.

Programmer Response: Verify that the variable name is spelled properly in the SQL statement, that the variable is allowed in the SQL statement, that the application program contains a declaration for that variable, and that the attributes of the variable are compatible with its use in the statement.

SQLSTATE: 37518


SQL Code -313
THE NUMBER OF HOST VARIABLES SPECIFIED IS NOT EQUAL TO THE NUMBER OF PARAMETER MARKERS

Explanation: The number of host variables specified in the EXECUTE or OPEN statement is not the same as the number of parameter markers (question marks) appearing in the prepared SQL statement.

System Action: The statement cannot be executed.

Programmer Response: Correct the application program so that the number of host variables specified in the EXECUTE or OPEN statement is the same as the number of parameter markers appearing in the prepared SQL statement.

SQLSTATE: 53017


SQL Code -314
THE STATEMENT CONTAINS AN AMBIGUOUS HOST VARIABLE REFERENCE

Explanation: A host variable used in the statement has been defined more than once in this application program causing confusion as to which host variable defined should be used.

System Action: The statement cannot be executed.

Programmer Response: Make the host variable unique or use qualifications to indicate which host variable definition is to be used.

SQLSTATE: 52014


SQL Code -330
A STRING CANNOT BE USED BECAUSE IT CANNOT BE TRANSLATED. REASON reason-code, CHARACTER code-point, HOST VARIABLE position-number

Explanation: The operation required the translation of a string to a different coded character set and a translation error occurred. The type of error is indicated by the 'reason-code':

  • 8 for length exception (e.g., expansion required for PC MIXED data exceeds the maximum length of the string).
  • 12 for invalid code point (e.g., use of the ERRORBYTE option of SYSSTRINGS).
  • 16 for form exception (e.g., invalid MIXED data).
  • 20 for translate procedure error (e.g., an exit set the length control field of the string to an invalid value).

If the 'reason-code' is 12, 'code-point' is the invalid code point. Otherwise, 'code-point' is either blank or an additional 'reason-code' returned by an exit. If the string is the value of an input host variable, the 'position-number' is the ordinality of the variable in the SQLDA. If the string is not the value of a host variable, the 'position-number' is blank.

System Action: The statement cannot be executed.

Programmer Response: If the 'reason-code' is 8, the maximum length of the host variable must be extended to allow for the expansion that occurs when the string is translated. If the 'reason-code' is 12, either the translate table must be changed to accept the 'code-point' or the data must be changed to eliminate the 'code-point'. If the 'reason-code' is 16 and the string is described as MIXED data, either its description must be changed or the string must be changed to conform to the rules for well-form ed mixed data. If the 'reason-code' is 20, the translate procedure must be corrected.

SQLSTATE: 22517


SQL Code -331
A STRING CANNOT BE ASSIGNED TO A HOST VARIABLE BECAUSE IT CANNOT BE TRANSLATED. REASON reason-code, CHARACTER code-point, POSITION position-number

Explanation: The operation required the translation of a string to the coded character set of the host variable and a translation error occurred. The type of error is indicated by the 'reason-code':

  • 8 for length exception (e.g., expansion required for PC MIXED data exceeds the maximum length of the string).
  • 12 for invalid 'code point' (e.g., use of the ERRORBYTE option of SYSSTRINGS).
  • 16 for form exception (e.g., invalid MIXED data).
  • 20 for translate procedure error (e.g., an exit set the length control field of the string to an invalid value).

If the 'reason-code' is 12, 'code-point' is the invalid 'code point'. Otherwise, 'code-point' is blank. The 'position-number' is the ordinality of the output variable in the SQLDA.

System Action: The statement cannot be executed.

Programmer Response: If the 'reason-code' is 8, the maximum length of the result column must be extended to allow for the expansion that occurs when the string is translated. If the 'reason-code' is 12, either the translate table must be changed to accept the 'code-point' or the data must be changed to eliminate the 'code point'. If the 'reason-code' is 16, and the string is described as MIXED data, either its description must be changed or the string must be changed to conform to the rules for well-fo rmed MIXED data. If the 'reason-code' is 20, the translate procedure must be corrected. An alternative to these corrective actions is to provide an indicator variable so that a null value and a warning can be returned rather than an error. Refer to SQL Reference for more information on coded character set.

SQLSTATE: 22518


SQL Code -332
SYSSTRINGS DOES NOT DEFINE A TRANSLATION FROM CCSID ccsid TO ccsid

Explanation: The operation required a translation of a string to a different coded character set, but the particular translation is not described in the SYSSTRINGS catalog table. The first 'ccsid' identifies the coded character set of the string and the second 'ccsid' identifies the coded character set to which it must be translated.

System Action: The statement cannot be executed.

Programmer Response: If the CCSIDs are correct, the only corrective action is to provide for the translation by inserting a row into SYSSTRINGS. For an SBCS translation, the row must contain a translate table or the name of a user-provided translate procedure. For a DBCS translation, the row must contain the name of a user-provided translate procedure. Refer to Chapter 3 of SQL Reference for more information on coded character set.

SQLSTATE: 57017


SQL Code -333
THE SUBTYPE OF A STRING VARIABLE IS NOT THE SAME AS THE SUBTYPE KNOWN AT BIND TIME AND THE DIFFERENCE CANNOT BE RESOLVED BY TRANSLATION

Explanation: The CCSID in the run time SQLDA is inconsistent with the bind time subtype of the host variable or parameter marker. Either the run time description is BIT and the bind time description was not BIT, or the run time description is not BIT and the bind time description was BIT

System Action: The statement cannot be executed.

Programmer Response: Change the CCSID in the SQLDA so that the subtype of the host variable is consistent with the bind time subtype of the host variable or parameter marker. Refer to Chapter 3 of SQL Reference for more information on coded character set.

SQLSTATE: 56010