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 -101 THE STATEMENT IS TOO LONG OR TOO COMPLEX

Explanation: The statement cannot be executed because it exceeds the system limits for either length or complexity.

System Action: The statement cannot be executed.

Programmer Response: Break the statement up into shorter or less complex SQL statements.

SQLSTATE: 54001


SQL Code -102
LITERAL STRING IS TOO LONG. STRING BEGINS string

Explanation: The string constant beginning with 'string' has a length greater than 254 characters or 124 graphic characters. Character strings with lengths greater than 254 and graphic strings with lengths greater than 124 can be specified only through assignment from host variables.

System Action: The statement cannot be executed.

Programmer Response: The requested function is not available interactively. If the error occurred in the context of an SQL statement embedded in an application program, the desired result can be achieved by assigning the long string to a host variable, and substituting that variable for the string literal in the SQL statement.

SQLSTATE: 54002


SQL Code -103
literal IS AN INVALID NUMERIC LITERAL

Explanation: The indicated 'literal' begins with a digit, but is not a valid integer, decimal, or float literal.

System Action: The statement cannot be executed.

Programmer Response: Correct the invalid literal.

SQLSTATE: 37504


SQL Code -104
ILLEGAL SYMBOL token VALID SYMBOLS ARE token-list

Explanation: A syntax error in the SQL statement was detected at 'token'.

A partial list of valid tokens, 'token-list', is provided. This list assumes that the statement is correct up to that point, and only as many tokens are listed as will fit.

System Action: The statement cannot be executed.

Programmer Response: Examine the statement in the area of the specified token.

If you are executing the SQL statement dynamically under TSO, be sure that if the data set containing the DSNHDECP load module has not been included in your LINKLSTxx, it has been included in STEPLIB statements in:

  1. The DB2 start-up procedure
  2. The TSO logon procedure or batch job JCL.

SQLSTATE: 37501
SQL Code -105
INVALID STRING

Explanation: The statement contains an invalid string. It is neither a character string nor a graphic string.

System Action: The statement cannot be executed.

Programmer Response: Specify the correct format of the string. Check for a graphic string, paired delimiters, the character G or N, and an even number of bytes within the string.

SQLSTATE: 37504


SQL Code -107
THE NAME name IS TOO LONG. MAXIMUM ALLOWABLE SIZE IS size

Explanation: The name returned as 'name' is too long. The maximum permissible length for names of that type is indicated by 'size'. Names for the following cannot contain more than 64 characters:

  • Version-id
Names for the following cannot contain more than 18 characters (20 including SQL escape characters, if present):
  • SQL columns
  • SQL tables
  • SQL views
  • SQL indexes
  • SQL aliases
  • SQL synonyms.
  • Collection-id
Names for the following cannot contain more than 16 characters:
  • Location-name
The following cannot contain more than 8 characters:
  • Table qualifiers
  • View qualifiers
  • Library member names specified in an INCLUDE statement
  • Storage group names
  • Database names
  • Table space names
  • Application plans
  • Database request modules (DBRMs)
  • Constraint names specified in CREATE or ALTER TABLE statements.
  • Package-id

Host variable names cannot contain more than 64 characters. Volume serial numbers cannot contain more than 6 characters. Labels cannot contain more than 30 characters.

System Action: The statement cannot be executed.

Programmer Response: Choose a shorter name for the object.

SQLSTATE: 54003


SQL Code -109
clause CLAUSE IS NOT PERMITTED

Explanation: The indicated clause is not permitted in the context in which it appears in this SQL statement. A subselect cannot have an INTO clause. A CREATE VIEW statement cannot have INTO, ORDER BY, or FOR UPDATE clauses. An embedded SELECT statement cannot have ORDER BY or FOR UPDATE clauses. SELECT statements used in cursor declarations cannot have an INTO clause.

System Action: The statement cannot be executed.

Programmer Response: Correct the SQL statement.

SQLSTATE: 37501


SQL Code -110
INVALID HEXADECIMAL LITERAL BEGINNING string

Explanation: The literal beginning with the specified 'string' contains one or more characters that are not valid hexadecimal digits.

System Action: The statement cannot be executed.

Programmer Response: Correct the invalid literal.

SQLSTATE: 37506


SQL Code -111
A COLUMN FUNCTION DOES NOT INCLUDE A COLUMN NAME

Explanation: The specification of a column function (AVG, MAX, MIN, or SUM) was invalid because such functions must include a column name in the operand.

System Action: The statement cannot be executed.

Programmer Response: A column name must be specified as an operand to the function. Refer to Chapter 4 of SQL Reference for information about the proper usage of column functions.

SQLSTATE: 56001


SQL Code -112
THE OPERAND OF A COLUMN FUNCTION IS ANOTHER COLUMN FUNCTION

Explanation: The operand of a column function can be either an expression or DISTINCT followed by an expression. The operand cannot be another column function.

System Action: The statement cannot be executed.

Programmer Response: Correct the function specification. Refer to Chapter 4 of SQL Reference for information about the proper usage of column functions.

SQLSTATE: 37507
SQL Code -113
INVALID CHARACTER FOUND IN NAME: name, REASON CODE - reason-code

Explanation: The name contains an invalid character. The name can be an SQL ordinary identifier name or a host variable name.

For SBCS ordinary identifiers, names of buffer pools, databases, plans and storage groups must contain only uppercase alphabetic or national characters and numerics when CHARSET is KATAKANA; the first character must be alphabetic or national.

The following reason codes apply to SBCS identifiers:

  • 000 An invalid character was found in the SBCS identifier (including the situation where a DBCS identifier is used where only an SBCS identifier is allowed.)
The following reason codes apply to DBCS identifiers.
  • 101 An odd number of bytes exists between the shift-out and the shift-in.
  • 102 No shift-in was found at the end of the identifier.
  • 103 DBCS blanks X'4040' are not allowed.
  • 104 There are no characters between the shift-out and the shift-in.
  • 105 Shift-out can not be the first byte of the DBCS character between the shift-out and the shift-in.

System Action: The statement cannot be executed.

User Response: Correct the name. Refer to Chapter 3 of SQL Reference for information about naming conventions.

System Action: The statement cannot be executed.

Programmer Response: Correct the name.

SQLSTATE: 37502


SQL Code -115
A PREDICATE IS INVALID BECAUSE THE COMPARISON OPERATOR operator IS FOLLOWED BY A PARENTHESIZED LIST OR BY ANY OR ALL WITHOUT A SUBQUERY

Explanation: A simple comparison like '>' must not be followed by a list of items. ANY and ALL comparisons must be followed by a subselect, rather than an expression or a list of items.

System Action: The statement cannot be executed.

Programmer Response: Correct the SQL statement. Refer to Chapter 6 of SQL Reference for information about the syntax of SQL statements.

SQLSTATE: 37501


SQL Code -117
THE NUMBER OF INSERT VALUES IS NOT THE SAME AS THE NUMBER OF OBJECT COLUMNS

Explanation: The number of insert values in the value list of the INSERT statement is not the same as the number of object columns specified.

System Action: The statement cannot be executed. No data was inserted into the object table.

Programmer Response: Correct the statement to specify one and only one value for each of the specified object columns.

SQLSTATE: 53002


SQL Code -118
THE OBJECT TABLE OR VIEW OF THE INSERT, DELETE, OR UPDATE STATEMENT IS ALSO IDENTIFIED IN A FROM CLAUSE

Explanation: The table or view specified as the object of an INSERT, DELETE, or UPDATE statement also appears in the FROM clause of a subselect within the statement.

The table or view that is the object of an INSERT, UPDATE, or DELETE cannot also be used to supply the values to be inserted or to qualify the rows to be inserted, updated, or deleted.

System Action: The statement cannot be executed. No data was inserted, updated, or deleted.

Programmer Response: The implied function is not supported by DB2. It may be possible to obtain the desired result by creating a temporary copy of the object table or view and addressing the subselect to that copy. Refer to Chapter 6 of SQL Reference for information about the syntax of SQL statements.

SQLSTATE: 56002


SQL Code -119
A COLUMN IDENTIFIED IN A HAVING CLAUSE IS NOT INCLUDED IN THE GROUP BY CLAUSE

Explanation: A column identified in a HAVING clause (possibly within a scalar function) does not appear in the GROUP BY clause. Columns specified in a HAVING clause must appear within column functions or also be specified in the GROUP BY clause.

System Action: The statement cannot be executed.

Programmer Response: The implied function is not supported by DB2. Refer to Chapter 5 of SQL Reference for information about the proper usage of HAVING and GROUP BY clauses.

SQLSTATE: 53003


SQL Code -120
A WHERE CLAUSE OR SET CLAUSE INCLUDES A COLUMN FUNCTION

Explanation: A column function is not permitted in a SET clause. A column function is allowed in a WHERE clause only if the WHERE clause appears within a subquery of a HAVING clause.

System Action: The statement cannot be executed.

Note: The 'column-name' may or may not be returned in SQLCA, depending on the nature of the error occurring in the SQL statement.

Programmer Response: The implied function is not supported by DB2. Refer to Chapter 5 of SQL Reference for information about restrictions on operands that can be specified within WHERE and SET clauses.

SQLSTATE: 56003


SQL Code -121
THE COLUMN name IS IDENTIFIED MORE THAN ONCE IN THE INSERT OR UPDATE STATEMENT

Explanation: The same column 'name' is specified more than once, either in the list of object columns of an INSERT statement, or the SET clause of an UPDATE statement.

System Action: The statement cannot be executed. No data was inserted or updated in the object table.

Programmer Response: Correct the syntax of the statement so that each column name is specified only once.

SQLSTATE: 52001


SQL Code -122
A SELECT STATEMENT WITH NO GROUP BY CLAUSE CONTAINS A COLUMN NAME AND A COLUMN FUNCTION IN THE SELECT CLAUSE OR A COLUMN NAME IS CONTAINED IN THE SELECT CLAUSE BUT NOT IN THE GROUP BY CLAUSE

Explanation: The SELECT statement contains one of these two types of errors:

  • The statement contains a column name and a column function in the SELECT clause, but no GROUP BY clause.
  • A column name is contained in the SELECT clause (possibly within a scalar function) but not in the GROUP BY clause. scalar function) but not in the GROUP BY clause.

System Action: The statement cannot be executed.

Programmer Response: Refer to Chapter 5 of SQL Reference for information about the use of GROUP BY clauses in SQL statements.

SQLSTATE: 53003


SQL Code -125
AN INTEGER IN THE ORDER BY CLAUSE DOES NOT IDENTIFY A COLUMN OF THE RESULT

Explanation: The ORDER BY clause in the statement contains a column number that is either less than one, or greater than the number of columns of the result table (the number of items in the SELECT clause).

System Action: The statement cannot be executed.

Programmer Response: Correct the syntax of the ORDER BY clause such that each column identifier properly denotes a column of the result table.

SQLSTATE: 53005


SQL Code -126
THE SELECT STATEMENT CONTAINS BOTH AN UPDATE CLAUSE AND AN ORDER BY CLAUSE

Explanation: The SELECT statement in the declaration for a cursor contains both an UPDATE clause and an ORDER BY clause. An ORDER BY clause cannot be specified in the declaration for a cursor that is to be used for update.

System Action: The statement cannot be executed. The cursor remains undefined in the application program.

Programmer Response: The implied function is not supported by DB2. A cursor that is to be used for update cannot be defined to fetch the rows of the object table in a specific order.

SQLSTATE: 53029


SQL Code -127
DISTINCT IS SPECIFIED MORE THAN ONCE IN A SUBSELECT

Explanation: The DISTINCT qualifier can be used only once in a SELECT statement or a subselect.

System Action: The statement cannot be executed.

Programmer Response: The implied function is not supported by DB2. Refer to Chapter 5 of SQL Reference for information about restrictions on the use of the DISTINCT qualifier.

SQLSTATE: 56005


SQL Code -128
INVALID USE OF NULL IN A PREDICATE

Explanation: The use of NULL in the search condition does not conform to the rules of SQL syntax.

System Action: The statement cannot be executed.

Programmer Response: The implied function is not supported by DB2. Refer to Chapter 3 of SQL Reference for information about the proper use of the NULL operand.

SQLSTATE: 37501


SQL Code -129
THE STATEMENT CONTAINS TOO MANY TABLE NAMES

Explanation: A subselect (including all subqueries) can have a maximum of 15 references to table names.

System Action: The statement cannot be executed.

Programmer Response: Break the SQL statement into two or more simpler statements with 15 or fewer table references in each. The count will include the number of base table occurrences from each table or view on the FROM list. Refer to Chapter 5 of SQL Reference for the definition of a subselect.

SQLSTATE: 54004


SQL Code -130
THE ESCAPE CLAUSE CONSISTS OF MORE THAN ONE CHARACTER, OR THE STRING PATTERN CONTAINS AN INVALID OCCURRENCE OF THE ESCAPE CHARACTER

Explanation: The ESCAPE character must be a single character, either SBCS or DBCS as appropriate. For 'column-name LIKE pattern', the ESCAPE character can only appear in the character string if it is followed by itself, %, or _ (underscore). The Escape Clause cannot be specified if the column name at the left of the LIKE or NOT LIKE has the MIXED subtype.

System Action: The statement cannot be executed.

Programmer Response: Correct the string pattern, or choose a different ESCAPE character and change the pattern accordingly, or eliminate the use of the Escape Clause on the LIKE or NOT LIKE predicate where the column name to the left has the MIXED subtype.

SQLSTATE: 22019


SQL Code -131
STATEMENT WITH LIKE PREDICATE HAS INCOMPATIBLE DATA TYPES

Explanation: If the column name at the left of LIKE or NOT LIKE is of type character, the expression at the right and the ESCAPE character must be of type character. If the column name is of type graphic, the expression at the right and the ESCAPE character must be of type graphic.

System Action: The statement cannot be executed.

Programmer Response: Check the data type of every operand.

SQLSTATE: 53018


SQL Code -132
A LIKE PREDICATE IS INVALID BECAUSE THE SECOND OPERAND IS NOT A STRING

Explanation: The token following LIKE must be a special register, a string constant, or a host variable with a string value.

System Action: The statement cannot be executed.

Programmer Response: The implied function is not supported by DB2. Refer to Chapter 3 of SQL Reference for information about the proper syntax for LIKE and NOT LIKE predicates.

SQLSTATE: 53024


SQL Code -133
A COLUMN FUNCTION IN A SUBQUERY OF A HAVING CLAUSE IS INVALID BECAUSE ALL COLUMN REFERENCES IN ITS ARGUMENT ARE NOT CORRELATED TO THE GROUP BY RESULT THAT THE HAVING CLAUSE IS APPLIED TO

Explanation: If a column function has a correlated column reference, it must be correlated from within a HAVING clause to the GROUP BY result that the HAVING clause is applied to. All column references in the argument must satisfy this condition.

System Action: The statement cannot be executed.

Programmer Response: Refer to Chapter 5 of SQL Reference for information about restrictions on the syntax of the HAVING clause.

SQLSTATE: 56006


SQL Code -134
IMPROPER USE OF LONG STRING COLUMN column-name OR A HOST VARIABLE OF MAXIMUM LENGTH GREATER THAN 254

Explanation: A long string was referenced in a context in which long strings are not allowed. For an exhaustive list of such contexts, refer to "Varying Length Character Strings" in Chapter 3 of SQL Reference.

System Action: The statement cannot be executed.

Note: The 'column-name' might not be returned in SQLCA, depending on the nature of the error and the syntax in which it occurred.

Programmer Response: The requested operation on a long string value is not supported by DB2. Refer to Chapter 3 of SQL Reference for information about restrictions on the specification and manipulation of long string values.

SQLSTATE: 56007


SQL Code -136
SORT CANNOT BE EXECUTED BECAUSE THE SORT KEY LENGTH IS GREATER THAN 4000 BYTES

Explanation: A sort key is derived from the list of columns specified following a DISTINCT qualifier, or in an ORDER BY or GROUP BY clause. If both a DISTINCT qualifier and an ORDER BY or GROUP BY clause are present, the sort key is derived from the combination of both lists of columns.

The internal length of the sort key cannot exceed 4000 bytes. In attempting to process the SQL statement, the internal length of the sort key derived from the DISTINCT and/or ORDER BY or GROUP BY specifications was found to exceed that 4000-byte maximum.

System Action: The statement cannot be executed.

Programmer Response: The statement must be modified such that the internal length of the sort key will not exceed 4000 bytes. In general, this means that one or more column names must be deleted from the ORDER BY or GROUP BY clause, or the list following the DISTINCT qualifier. or GROUP BY clause, or the list following the DISTINCT qualifier.

SQLSTATE: 54005


SQL Code -137
RESULT OF CONCATENATION TOO LONG

Explanation: The length of the result of a concatenation exceeds 32,764 (if character operands) or 16,382 (if graphic operands).

System Action: The statement cannot be executed.

Programmer Response: Ensure that the total of the lengths of the concatenated operands is less than or equal to 32,764 (for character operands) or 16,382 (for graphic operands).

SQLSTATE: 54006


SQL Code -138
THE SECOND OR THIRD ARGUMENT OF THE SUBSTR FUNCTION IS OUT OF RANGE

Explanation: One of the following conditions exists:

  • The second argument of the SUBSTR function is less than 1 or greater than M.
  • The third argument of the SUBSTR function is an integer constant 0 or an expression whose value is less than 0 or greater than M-N+1.
M is the length of the first argument, if it is of fixed-length, or M is the maximum length of the first argument, if it is of varying-length. N is the value of the second argument.

System Action: The statement cannot be executed.

Programmer Response: Ensure that the second and third arguments of the SUBSTR function have legal values according the above rules.

SQLSTATE: 22011


SQL Code -144
INVALID SECTION NUMBER number

Explanation: The section number in the call parameter list is negative, an invalid duplicate, or greater than the maximum section number of the DBRM or package.

System Action: The statement cannot be executed.

Programmer Response: Examine the application program to determine if the call parameter list has been modified in some way. In general, the application programmer should not attempt to modify the output of the precompiler.

SQLSTATE: 58003


SQL Code -150
THE OBJECT OF THE INSERT, DELETE, OR UPDATE STATEMENT IS A VIEW FOR WHICH THE REQUESTED OPERATION IS NOT PERMITTED

Explanation: The view named in the INSERT, UPDATE, or DELETE statement is defined in such a way that the requested insert, update, or delete operation cannot be performed upon it.

Inserts into a view are prohibited if:

  • The view definition contains a join or a GROUP BY or HAVING clause.
  • The SELECT clause in the view definition contains the DISTINCT qualifier, an arithmetic expression, a string expression, a built-in function, or a constant.
  • Two or more columns of the view are derived from the same column.
  • A base table of the view contains a column that does not have a default value and is not included in the view.
Updates to a view are prohibited if:
  • The view definition contains a join or a GROUP BY or HAVING clause.
  • The SELECT clause in the view definition contains the DISTINCT qualifier or a function.
Also, a given column in a view cannot be updated (that is, the values in that column cannot be updated) if the column is derived from an arithmetic expression, a constant, or a column that is part of the key of a partitioned index.

Deletes against a view are prohibited if:

  • The view definition contains a join or a GROUP BY or HAVING clause.
  • The SELECT clause in the view definition contains the DISTINCT qualifier or a built-in function.

System Action: The statement cannot be executed. No data was inserted, updated, or deleted.

Programmer Response: The requested function cannot be performed on the view. Refer to Chapter 5 of SQL Reference for further information regarding inserting, deleting, and updating views.

SQLSTATE: 53007
SQL Code -151
THE UPDATE STATEMENT IS INVALID BECAUSE THE CATALOG DESCRIPTION OF COLUMN column-name INDICATES THAT IT CANNOT BE UPDATED

Explanation: The specified column cannot be updated due to one of the following:

  • The object table is partitioned (that is, resides in a partitioned table space) and the column is included in the partitioning key.
  • The object table is a view and the specified column is defined (in the definition of the view) in such a way that it cannot be updated.
  • The object table is a catalog table.

The values for columns occurring in the partitioning key of a partitioned table cannot be updated.

Individual columns in a view cannot be updated for one of the following reasons:

  • The column is derived from an SQL function, an arithmetic expression, or a constant.
  • The column is defined for a column that is in the partitioning key of a partitioned table.
  • The column is defined for a column of an underlying view that cannot be updated.

System Action: The statement cannot be executed. No data was updated in the object table or view.

Programmer Response: The requested function is not supported by DB2. Refer to Chapter 5 of SQL Reference for information regarding restrictions on the ability to update columns in partitioned tables and views.

SQLSTATE: 53008


SQL Code -153
THE CREATE VIEW STATEMENT DOES NOT INCLUDE A REQUIRED COLUMN LIST

Explanation: You must specify a list of column names if the result table of the subselect has duplicate column names or an unnamed column (a column derived from a constant, function, or expression).

System Action: The statement cannot be executed. The specified view was not created.

Programmer Response: Correct the statement by providing a list of names for the columns of the view. Refer to Chapter 6 of SQL Reference for information about the syntax of the CREATE VIEW statement.

SQLSTATE: 56008


SQL Code -154
THE CREATE VIEW FAILED BECAUSE THE VIEW DEFINITION CONTAINS A UNION, A UNION ALL, OR A REMOTE OBJECT

Explanation: The view defined in the CREATE VIEW statement contains a UNION, a UNION ALL, or a remote object. DB2 cannot create views containing unions or a remote object.

System Action: The CREATE VIEW statement cannot be executed. The specified view is not created.

Programmer Response: Refer to Chapter 6 of SQL Reference for information about restrictions on the definitions for views.

SQLSTATE: 56009


SQL Code -156
THE STATEMENT DOES NOT IDENTIFY A TABLE

Explanation: The statements ALTER TABLE, DROP TABLE, LOCK TABLE, and CREATE INDEX apply only to tables. Indexes can be defined only on tables.

System Action: The statement cannot be executed. The specified view or remote object was not altered, dropped, or locked, or the index was not created.

Programmer Response: Verify that the proper name was specified in the statement.

SQLSTATE: 53009


SQL Code -157
ONLY A TABLE NAME CAN BE SPECIFIED IN A FOREIGN KEY CLAUSE. IS NOT THE NAME OF A TABLE.

Explanation: The indicated object was identified in a FOREIGN KEY clause of a CREATE or ALTER TABLE statement. A FOREIGN KEY clause must identify a table.

System Action: The statement cannot be executed.

Programmer Response: Correct the statement to specify a table name in the foreign key clause.

SQLSTATE: 53010


SQL Code -158
THE NUMBER OF COLUMNS SPECIFIED FOR THE VIEW IS NOT THE SAME AS THE NUMBER OF COLUMNS SPECIFIED BY THE SELECT CLAUSE

Explanation: The number of column names specified for a view in a CREATE VIEW statement must equal the number of elements (column names, SQL functions, expressions, etc.) specified in the following AS SELECT clause.

System Action: The statement cannot be executed. The specified view was not created.

Programmer Response: Correct the syntax of the statement to specify a column name for each column in the view to be created. Refer to Chapter 6 of SQL Reference for information about the syntax of the CREATE VIEW statement.

SQLSTATE: 53011


SQL Code -159
DROP OR COMMENT ON token IDENTIFIES A(N) token RATHER THAN A(N) token

Explanation: The object specified in the DROP VIEW statement, DROP ALIAS statement, or COMMENT ON ALIAS statement identifies a table instead of a view or an alias.

The DROP VIEW statement can have only a view as its object. The DROP ALIAS or COMMENT ON ALIAS statement can have only an alias as its object. You must use the DROP TABLE statement to drop a table that is neither a view nor an alias. You must use the COMMENT ON TABLE statement to comment on a table.

System Action: The statement cannot be executed.

Programmer Response: Correct the DROP VIEW, DROP ALIAS, or COMMENT ON ALIAS statement so that the view name or the alias name is specified correctly (with the proper qualifier). If you intended to drop or comment on the specified table, use the DROP TABLE or COMMENT ON TABLE statement.

SQLSTATE: 53009


SQL Code -160
THE WITH CHECK OPTION CANNOT BE USED FOR THE SPECIFIED VIEW

Explanation: The WITH CHECK OPTION does not apply to a view definition under either of the following circumstances:

  • The view is defined as 'read-only' (for example, the view is defined on more than one base table or other view).
  • The SELECT statement of the view contains a subselect, a GROUP BY or HAVING clause, or the DISTINCT keyword.

System Action: The statement cannot be executed. The specified view was not created.

Programmer Response: Refer to Chapter 6 of SQL Reference for rules regarding use of the WITH CHECK OPTION in view definitions.

SQLSTATE: 53013


SQL Code -161
THE INSERT OR UPDATE IS NOT ALLOWED BECAUSE A RESULTING ROW DOES NOT SATISFY THE VIEW DEFINITION

Explanation: The WITH CHECK OPTION applies to the view that is the object of the INSERT or UPDATE statement. Consequently, all attempts to insert or update rows in that view are checked to ensure that the results will conform to the view definition.

System Action: The statement cannot be executed. No inserts or updates were performed, and the contents of the object view (and underlying base table) remain unchanged.

Programmer Response: Examine the view definition to determine why the requested INSERT or UPDATE was rejected. Note that this may be a data-dependent condition.

SQLSTATE: 23501


SQL Code -164
auth-id1 DOES NOT HAVE THE PRIVILEGE TO CREATE A VIEW WITH QUALIFICATION authorization ID

Explanation: The authorization ID 'auth-id' does not have the authority necessary to create views with qualifiers other than its own authorization ID. Specifically, the attempt to create a view with qualifier 'authorization ID' is rejected.

System Action: The statement cannot be executed. The specified view was not created.

Programmer Response: Do not attempt to create views with other than your own ID as a qualifier. Only an authorization ID that holds 'SYSADM' authority can create views for other authorization IDs.

SQLSTATE: 42502
SQL Code -170
THE NUMBER OF ARGUMENTS SPECIFIED FOR function-name IS INVALID

Explanation: An SQL statement includes the scalar function 'function-name' with either too many or too few arguments.

System Action: The statement cannot be executed.

Programmer Response: Correct the statement. Refer to Chapter 4 of SQL Reference for information about the number of arguments required by the scalar function 'function-name'.

SQLSTATE: 37505


SQL Code -171
THE DATA TYPE, LENGTH, OR VALUE OF ARGUMENT nn OF function-name IS INVALID

Explanation: Either the data type, the length or the value of argument 'nn' of scalar function 'function-name' is incorrect.

System Action: The statement cannot be executed.

Programmer Response: Correct the statement. Refer to Chapter 4 of SQL Reference for rules for each argument of the scalar function 'function-name'.

SQLSTATE: 53015


SQL Code -180
THE STRING REPRESENTATION OF A DATETIME VALUE HAS INVALID SYNTAX

Explanation: The string representation of a datetime value does not conform to the syntax for the specified or implied data type.

System Action: The statement cannot be executed.

Programmer Response: Check that the datetime value conforms to the syntax for the data type it represents.

SQLSTATE: 22007


SQL Code -181
THE STRING REPRESENTATION OF A DATETIME VALUE IS NOT A VALID DATETIME VALUE

Explanation: The string representation of a datetime is not in the acceptable range or is not in the correct format. The proper ranges for datetime values are as follows:

   ³ Datetime                                               ³ Numeric Range ³
   ³ Years                                                  ³ 0001 to 9999  ³
   ³ Months                                                 ³ 1 to 12       ³
   ³ Days                                                                   ³
   ³   ³ April, June, September, November (months 4, 6, 9,  ³ 1 to 30       ³
   ³   ³ 11)                                                ³               ³
   ³   ³ February (month 2)                                 ³ 1 to 28 (Leap ³
   ³   ³                                                    ³ year 1 to 29) ³
   ³   ³ January, March, May, July, August, October,        ³ 1 to 31       ³
   ³   ³ December (months 1, 3, 5, 7, 8, 10, 12)            ³               ³
   ³ Hours                                                  ³ 0 to 24 (If   ³
   ³                                                        ³ hour is 24,   ³
   ³                                                        ³ hour is 24,   ³
   ³                                                        ³ other parts   ³
   ³                                                        ³ of time       ³
   ³                                                        ³ values are    ³
   ³                                                        ³ zeroes.  If   ³
   ³                                                        ³ time is USA,  ³
   ³                                                        ³ maximum hour  ³
   ³                                                        ³ is 12)        ³
   ³ Minutes                                                ³ 0 to 59       ³
   ³ Seconds                                                ³ 0 to 59       ³
   ³ Microseconds                                           ³ 0 to 999999   ³

System Action: The statement cannot be executed.

Programmer Response: Check whether the value is within the valid range and is in the proper format. Refer to Chapter 3 of SQL Reference for information on string data formats.

SQLSTATE: 22007


SQL Code -182
AN ARITHMETIC EXPRESSION WITH A DATETIME VALUE IS INVALID

Explanation: The specified arithmetic expression contains an improperly used datetime value or labeled duration.

System Action: The statement cannot be executed.

Programmer Response: Correct the indicated arithmetic expression.

SQLSTATE: 53016


SQL Code -183
AN ARITHMETIC OPERATION ON A DATE OR TIMESTAMP HAS A RESULT THAT IS NOT WITHIN THE VALID RANGE OF DATES

Explanation: The result of an arithmetic operation is a date or timestamp that is not within the valid range of dates which are between 0001-01-01 and 9999-12-31.

System Action: The statement cannot be executed.

Programmer Response: Examine the SQL statement to see if the cause of the problem can be determined. The problem may be data-dependent, in which case it will be necessary to examine the data that was processed at the time the error occurred.

SQLSTATE: 22008


SQL Code -184
AN ARITHMETIC EXPRESSION WITH A DATETIME VALUE CONTAINS A PARAMETER MARKER

Explanation: The specified arithmetic expression contains a parameter marker improperly used with a datetime value.

System Action: The statement cannot be executed.

Programmer Response: Correct the indicated arithmetic expression.

SQLSTATE: 37510


SQL Code -185
THE LOCAL FORMAT OPTION HAS BEEN USED WITH A DATE OR TIME AND NO LOCAL EXIT HAS BEEN INSTALLED

Explanation: The local format option has been used with a datetime value and no datetime exit has been installed. This may occur if the LOCAL DATE LENGTH or LOCAL TIME LENGTH on the Installation Application Programming Defaults Panel indicated that an exit for datetime was supplied, but in fact the exit supplied by DB2 was not replaced. This may also occur if the datetime exit was replaced and the corresponding LOCAL DATE LENGTH or LOCAL TIME LENGTH on the Installation Application Programming Defaults Panel was not set to a non-zero value.

System Action: The statement cannot be executed.

Programmer Response: Contact the system programmer about installation of the date or time exit.

SQLSTATE: 57008


SQL Code -186
THE LOCAL DATE LENGTH OR LOCAL TIME LENGTH HAS BEEN INCREASED AND EXECUTING PROGRAM RELIES ON THE OLD LENGTH

Explanation: The local format option has been used with a datetime value and DB2 has discovered that the datetime exit routine has been changed to produce a longer local format.

System Action: The statement cannot be executed.

Programmer Response: If the statement receiving this error is embedded in the application program, then a REBIND command must be issued for the application plan. If the statement was dynamic SQL, then the statement may be re-entered.

SQLSTATE: 22505


SQL Code -187
A REFERENCE TO A CURRENT DATE/TIME SPECIAL REGISTER IS INVALID BECAUSE THE MVS TOD CLOCK IS BAD OR THE MVS PARMTZ IS OUT OF RANGE

Explanation: DB2 has encountered an invalid time-of-day (TOD) clock. The user referenced one of the special registers: CURRENT DATE, CURRENT TIME, CURRENT TIMESTAMP, or CURRENT TIMEZONE. If the user referenced CURRENT TIMEZONE, the MVS parameter PARMTZ was out of range.

System Action: The statement cannot be executed.

Programmer Response: For CURRENT TIMEZONE, check that the MVS parameter PARMTZ is between -24 and +24 hours. For the other CURRENT special registers, check that the MVS TOD clock has been set correctly.

SQLSTATE: 22506


SQL Code -188
THE STRING REPRESENTATION OF A NAME IS INVALID

Explanation: The host variable referenced in the DESCRIBE TABLE statement does not contain a valid string representation of a name. One of the following error conditions has occurred.

  • The first byte of the variable is a period or a blank.
  • The number of identifiers is greater than 3.
  • An identifier is too long.
  • A period not contained in a delimited identifier is followed by a period or a blank.
  • A delimited identifier is followed by a character other than a period or a blank.
  • A delimited identifier is not terminated by a quotation mark.

System Action: The statement cannot be executed.

Programmer Response: Correct the value of the host variable so that it is a valid string representation of a name.

SQLSTATE: 22503


SQL Code -189
CCSID ccsid IS UNKNOWN OR INVALID FOR THE DATA TYPE OR SUBTYPE

Explanation: To determine the subtype of an input host variable or result column, the SYSSTRINGS catalog table was accessed with the specified CCSID and:

  • The CCSID is not a value of either INCCSID or OUTCCSID, or
  • The TRANSTYPE column classifies the CCSID as GRAPHIC rather than CHARACTER.

This error can also occur when SYSSTRINGS is accessed with a pair of CCSIDs to determine if a translation is defined for the pair. In this case, the error is the inconsistency between the data type of a string and the TRANSTYPE classification of its CCSID (one is GRAPHIC and the other is CHARACTER).

System Action: The statement cannot be bound or executed.

Programmer Response: Ensure that the CCSSID is valid and consistent with the data type of the string. If a valid CCSID is not listed in a built-in row of SYSSTRINGS, it can be defined by inserting a user-provided row. If a valid CCSID is misclassified in a user-provided row, that row can be updated to correct the mistake. Refer to the appendices of SQL Reference for more information on CCSIDs.

SQLSTATE: 22522


SQL Code -191
A STRING CANNOT BE USED BECAUSE IT IS INVALID MIXED DATA

Explanation: The operation required the translation of a mixed data character string to a different coded character set. The string could not be translated because it does not conform to the rules for well-formed mixed data. For example, the string contains EBCDIC shift codes that are not properly paired.

System Action: The statement cannot be executed.

Programmer Response: If the string contains the intended information, the description of the column or host variable should be changed from MIXED DATA to BIT or SBCS DATA. If the description of the column or host variable is correct, the string is the problem and it must be changed to conform to the rules for well-formed mixed data. For more information about well-formed MIXED DATA refer to Chapter 3 of SQL Reference. about well-formed MIXED DATA refer to Chapter 3 of SQL Reference.

SQLSTATE: 22504


SQL Code -198
THE OPERAND OF THE PREPARE OR EXECUTE IMMEDIATE STATEMENT IS BLANK OR EMPTY

Explanation: The operand (host variable or literal string) that was the object of the PREPARE or EXECUTE IMMEDIATE statement either contained all blanks or was an empty string. A DBRM built in release 2.3 cannot be used on a release 2.2 system if the distributive functions was used. If this error appears on release 2.2 and the DBRM was built on 2.3, the program needs to be precompiled again to correct the problem.

System Action: The statement cannot be executed.

Programmer Response: Correct the logic of the application program to ensure that a valid SQL statement is provided in the operand of the PREPARE or EXECUTE IMMEDIATE statement before that statement is executed.

SQLSTATE: 37517


SQL Code -199
ILLEGAL USE OF KEYWORD keyword. TOKEN token-list WAS EXPECTED

Explanation: A syntax error was detected in the statement at the point where the keyword 'keyword' appears.

As an aid to the programmer, a partial list of valid tokens is provided in SQLERRM as 'token-list'. This list assumes that the statement is correct up to that point, and only as many tokens are listed as will fit.

System Action: The statement cannot be executed.

Programmer Response: Examine the statement in the area of the indicated keyword. A colon or SQL delimiter may be missing.

SQLSTATE: 37501