Expected Tokens May Include Database Alias Sqlstate 42601

IBM Books

Messages Reference


SQL0100 - SQL0199



SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table.

Cause: One of the following conditions is true:

  • No row was found that meets the search conditions specified in an UPDATE or DELETE statement.
  • The result of a SELECT statement was an empty table.
  • A FETCH statement was executed when the cursor was positioned after the last row of the result table.
  • The result of the SELECT used in an INSERT statement is empty.

No data was retrieved, updated, or deleted.

Action: No action is required. Processing can continue.

sqlcode: +100

sqlstate: 02000



SQL0101N The statement is too long or too complex.

Cause: The statement could not be processed because it exceeds a system limit for either length or complexity, or because too many constraints or triggers are involved.

If the statement is one that creates or modifies a packed description, the new packed description may be too large for its corresponding column in the system catalogs.

DataJoiner users should also check to see if the statement:

  • Exceeds either a DataJoiner system limit or a data source system limit for length or complexity.
  • Violates some other data source specific limit.

The statement cannot be processed.

Note: Where character data conversions are performed for applications and databases running under different codepages, the result of the conversion is exceeding the length limit.

Action: Either:

  • Break the statement up into shorter or less complex SQL statements.
  • Increase the size of the statement heap (stmtheap) in the database configuration file.
  • Reduce the number of check or referential constraints involved in the statement or reduce the number of indexes on foreign keys.
  • Reduce the number of triggers involved in the statement.
  • DataJoiner users: determine which data source is failing the statement (see the Problem Determination Guide for procedures to follow to identify the failing data source) and determine the cause of the rejection. If the rejection is coming from DataJoiner, increase the size of the statement heap (stmtheap) in the database configuration file.

sqlcode: -101

sqlstate: 54001



SQL0102N The string constant beginning with "<string>" is too long.

Cause: One of the following has occurred:

  • The comment in the COMMENT ON statement is greater than 254 bytes.
  • The application server name specified in the SQL CONNECT statement is greater than 18 characters.
  • The string constant beginning with "<string>" has a length greater than 4000 bytes. Character strings with lengths greater than 4000 bytes or graphic strings with lengths greater than 2000 characters can be specified only through assignment from host variables. Note that other servers in the DB2 family of products may specify a different size limit for character strings. Consult the documentation for the appropriate DB2 product for details.
  • DataJoiner users: the data source-specific limits must not be exceeded in a pass-through session. For example, a character literal larger than 254 bytes included in a statement sent to DB2 for MVS in a pass-through session would cause this error.

It may be that data conversion is occurring and the resultant string is too long. For connections between applications and databases running under different codepages, string constants are converted from the application codepage to the database codepage. In certain situations, graphic string constants may be further converted from the database codepage to a UCS-2 (UNICODE) encoding, for example when the database has been created with an EUC codepage. This means that it is possible to have a resultant string which is longer than the input string.

The statement cannot be processed.

Action: For Comment on Table or Comment on Column, reduce the size of the comment. For the SQL CONNECT statement, reduce the length of the application server name. For other string constants, the requested function is not available interactively. For an error occurring in the context of a non-CONNECT SQL statement embedded in an application program, assign the long string to a host variable and substitute that variable for the string literal in the SQL statement.

DataJoiner users: for a pass-through session, determine what data source is causing the error (see the Problem Determination Guide for the failing data sources). Examine the SQL dialect for that data source to determine which specific limit has been exceeded, and adjust the failing statement as needed.

sqlcode: -102

sqlstate: 54002



SQL0103N The numeric literal "<literal>" is not valid.

Cause: The indicated "<literal>" begins with a digit but is not a valid integer, decimal, or floating point literal.

DataJoiner users: a data source-specific literal representation error has occurred in a pass-through session.

The statement cannot be processed.

Action: Correct the invalid numeric literal. DataJoiner users, if the error occurred in a pass-through session, determine what data source is causing the error (see the Problem Determination Guide for the failing data sources). Examine the SQL dialect for that data source to determine which literal representation rule has been violated, and adjust the failing statement as needed.

sqlcode: -103

sqlstate: 42604



SQL0104N An unexpected token "<token>" was found following "<text>". Expected tokens may include: "<token-list>".

Cause: A syntax error in the SQL statement was detected at the specified token following the text "<text>". The "<text>" field indicates the 20 characters of the SQL statement that preceded the token that is not valid.

As an aid to the programmer, a partial list of valid tokens is provided in the SQLERRM field of the SQLCA as "<token-list>". This list assumes the statement is correct to that point.

The statement cannot be processed.

Action: Examine and correct the statement in the area of the specified token.

sqlcode: -104

sqlstate: 42601



SQL0105N The string constant beginning with "<string>" is not valid.

Cause: The statement contains a string constant beginning with "<string>" that is not valid.

The statement cannot be processed.

Action: Specify the correct format of the string constant. Check for graphic string, paired delimiters, and an even number of bytes within the string.

DataJoiner users, see the Problem Determination Guide to determine which data source is causing the error.

sqlcode: -105

sqlstate: 42604



SQL0107N The name "<name>" is too long. The maximum length is "<length>".

Cause: The name returned as "<name>" is too long. The maximum length permitted for names of that type is indicated by "<length>".

The names for columns, tables, views, indexes, aliases, and constraints can be a maximum length of 18 bytes. (This does not include any escape characters, if present.)

A maximum of 8 bytes is permitted for a schema name (object qualifier).

Host variable names must not exceed 30 bytes in length.

For the SQL CONNECT statement, an application server name of up to 18 characters in length will be accepted at pre-compilation time. However, at runtime, an application server name which is greater than 8 characters in length will cause an error.

Also, a password of up to 18 characters in length and an authorization ID of up to 8 characters in length will be accepted in the SQL CONNECT statement.

DataJoiner users: if in a pass-through session, a data source-specific limit might have been exceeded.

The statement cannot be processed.

Note: Where character data conversions are performed for applications and databases running under different codepages, the result of the conversion is exceeding the length limit.

Action: Choose a shorter name or correct the spelling of the object name.

DataJoiner users: for a pass-through session, determine what data source is causing the error (see the Problem Determination Guide for the failing data sources). Examine the SQL dialect for that data source to determine which specific limit has been exceeded, and adjust the failing statement as needed.

sqlcode: -107

sqlstate: 42622



SQL0108N The name "<name>" has the wrong number of qualifiers.

Cause: The name "<name>" is improperly qualified.

The object given the name "<name>" can only have one qualifier.

A column name is qualified with a table name, which is either qualified or unqualified, or a correlation name. In some contexts, a column name requires a table name qualifier.

The statement cannot be processed.

Action: Ensure that the name for the object is qualified correctly.

sqlcode: -108

sqlstate: 42601



SQL0109N The "<clause>" clause is not allowed.

Cause: The indicated clause is not allowed in the context where it appears in the SQL statement.

A subquery, an INSERT statement, or 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. An embedded SELECT statement cannot contain a set operator except in a subquery. SELECT or VALUES statements used in cursor declarations cannot have an INTO clause. A RAISE_ERROR function can only be used as a select list item if it is cast to some data type using the CAST specification.

DataJoiner users: the indicated clause may be missing and may be required. In a pass-through session, a data source-specific restriction might have been violated.

The statement cannot be processed.

Action: Correct the SQL statement by removing the clause.

DataJoiner users: correct the SQL statement by removing or adding the clause. For a pass-through session, determine what data source is causing the error (see the Problem Determination Guide for the failing data sources.) Examine the SQL dialect for that data source to determine which specific restriction has been violated, and adjust the failing statement as needed.

sqlcode: -109

sqlstate: 42601



SQL0110N "<string>" is an invalid hexadecimal constant.

Cause: The hexadecimal constant "<string>" is invalid. The problem is one of the following:

  • An invalid hexadecimal digit was specified. Only '0 to 9', 'A to F', and 'a to f' are allowed.
  • An uneven number of hexadecimal digits was specified.
  • More than 8000 hexadecimal digits were specified.

Action: Correct the constant and resubmit the statement.

sqlcode: -110

sqlstate: 42606



SQL0111N The column function "<name>" does not include a column name.

Cause: The specification of the column function "<name>" (AVG, MIN, MAX, SUM, or COUNT(DISTINCT)) was not specified correctly because such functions must include a column name in the operand.

The statement cannot be processed.

Action: Specify a column name in the expression that is the operand to the column function.

NOTE: This error is only applicable to releases of DB2 prior to Version 2.

sqlcode: -111

sqlstate: 42901



SQL0112N The operand of the column function "<name>" includes a column function, a scalar fullselect, or a subquery.

Cause: The operand of a column function cannot include a:

  • column function
  • scalar fullselect
  • subquery.

In a SELECT list, the operand of an arithmetic operator cannot be a column function that includes the DISTINCT keyword.

The statement cannot be processed.

Action: Correct the use of the column function to eliminate the invalid expression and try again.

sqlcode: -112

sqlstate: 42607



SQL0117N The number of values assigned is not the same as the number of specified or implied columns.

Cause:

  • The number of insert values in the value list of the INSERT statement is not the same as the number of columns specified or implied. If no column list is specified, a column list that includes all columns of the table or view is implied.
  • The number of values on the right hand side of an assignment in a SET transition-variable statement or SET clause of an UPDATE statement does not match the number of columns on the left hand side.

The statement cannot be processed.

Action: Correct the statement to specify one value for each of the specified or implied columns.

sqlcode: -117

sqlstate: 42802



SQL0118N The table or view that is the target of the INSERT, DELETE, or UPDATE statement is also specified in a FROM clause.

Cause: The table or view specified as the target of an INSERT, DELETE, or UPDATE statement also appears in the FROM clause of a subquery within the statement.

The table or view that is the target 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.

The statement cannot be processed.

This message is only applicable to Version 1.2 servers and earlier, and hosts accessed through DB2 Connect.

Action: The implied function is not supported. To attempt to obtain the desired result, create a temporary copy of the object table or view and address the subselect to that copy.

sqlcode: -118

sqlstate: 42902



SQL0119N An expression starting with "<expression-start>" specified in a SELECT clause, HAVING clause, or ORDER BY clause is not specified in the GROUP BY clause or it is in a SELECT clause, HAVING clause, or ORDER BY clause with a column function and no GROUP BY clause is specified.

Cause: The SELECT statement has one of the following errors:

  • The identified expression and a column function are contained in the SELECT clause, HAVING clause, or ORDER BY clause but there is no GROUP BY clause
  • The identified expression is contained in the SELECT clause, HAVING CLAUSE, or ORDER BY clause but is not in the GROUP BY clause.

The identified expression is an expression that starts with "<expression-start>". The expression may be a single column name.

If the NODENUMBER or PARTITION functions are specified in the HAVING clause, then all partitioning key columns of the underlying table are considered to be in the HAVING clause.

The statement cannot be processed.

Action: Correct the statement by including the expression in the GROUP BY clause that are in the SELECT clause, HAVING clause, or ORDER BY clause or by removing the column function from the SELECT statement.

sqlcode: -119

sqlstate: 42803



SQL0120N A WHERE clause, GROUP BY clause, SET clause, or SET transition-variable statement contains a column function.

Cause: A WHERE clause can contain a column function only if that clause appears within a subquery of a HAVING clause and the argument of the column function is a correlated reference to a group. A GROUP BY clause can contain a column function only if the argument of the column function is a correlated reference to a column in a different subselect than the one containing the GROUP BY clause. A SET clause of an UPDATE statement or a SET transition-variable statement can only include a column function within a fullselect on the right hand side of an assignment.

The statement cannot be processed.

Action: Change the statement so that the column function is not used or used only where it is supported.

sqlcode: -120

sqlstate: 42903



SQL0121N The column "<name>" is specified more than once in the INSERT, UPDATE or SET transition-variable statement.

Cause: The same column "<name>" is specified more than once in the list of columns of an INSERT statement, the left hand side of assignments in the SET clause of an UPDATE statement, or the left hand side of assignments in the SET transition-variable statement. Note that this error may occur when updating or inserting into a view where more than one column of the view is based on the same column of a base table.

The statement cannot be processed.

Action: Correct the syntax of the statement so each column name is specified only once.

sqlcode: -121

sqlstate: 42701



SQL0122N 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.

Cause: The SELECT statement has one of the following errors:

  • A column name and a column function are contained in the SELECT clause but there is no GROUP BY clause.
  • A column name is contained in the SELECT clause but not in the GROUP BY clause.

The column may be contained in a scalar function.

If the NODENUMBER or PARTITION functions are specified in the SELECT clause, then all partitioning key columns of the underlying table are considered to be in the SELECT clause.

The statement cannot be processed.

Action: Correct the statement by including the columns in the GROUP BY clause that are in the SELECT clause or by removing the columns from the SELECT clause.

sqlcode: -122

sqlstate: 42803



SQL0123N The parameter in position "<n>" in the function "<name>" must be a constant or a keyword.

Cause: The parameter in position "<n>" in the function "<name>" is not a constant when it is required to be a constant or a keyword when it is required to be a keyword.

Action: Ensure that each argument of the function conforms to the definition of the corresponding parameter.

sqlcode: -123

sqlstate: 42601



SQL0125N The column number in the ORDER BY clause is either less than one or greater than the number of columns in the result table.

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

The statement cannot be processed.

Action: Correct the syntax of the ORDER BY clause so each column identifier properly identifies a column of the result table.

sqlcode: -125

sqlstate: 42805



SQL0127N DISTINCT is specified more than once.

Cause: The DISTINCT qualifier cannot be used:

  • In both the SELECT clause and a column function
  • In two or more column functions in the same SELECT statement.

The statement cannot be processed.

Action: This error is only applicable to releases of DB2 prior to DB2 Version 2 and hosts accessed through DB2 Connect.

sqlcode: -127

sqlstate: 42905



SQL0129N The statement contains too many table names (the maximum is 15).

Cause: The SQL statement contains too many table names. A single SQL statement can reference up to 15 tables. Each table in any view referenced is included in this limit.

The statement cannot be processed.

Action: Break the SQL statement into two or more simple statements with 15 or fewer table references.

This message is only applicable to Version 1.2 servers and earlier, and hosts accessed through DB2 Connect.

sqlcode: -129

sqlstate: 54004



SQL0130N The ESCAPE clause is not a single character, or the pattern string contains an invalid occurrence of the escape character.

Cause: The escape character must be a single character no more than two bytes in length. It can only appear in the pattern string if it is followed by itself, a percent sign, or an underscore. For more information about the ESCAPE clause on the LIKE predicate, refer to the SQL Reference.

Action: Correct the pattern string or the escape character accordingly.

sqlcode: -130

sqlstate: 22019, 22025



SQL0131N The operands of a LIKE predicate have incompatible data types.

Cause: If the expression to the left of a LIKE or NOT LIKE is of type character, the expression to the right must be of type character.

If the expression to the left is of type graphic, the expression to the right must be of type graphic.

If the expression to the left is of type BLOB, the expression to the right must be of type BLOB.

The statement cannot be processed.

Action: Correct the expressions of the LIKE predicate to be the same data type.

sqlcode: -131

sqlstate: 42818



SQL0132N A LIKE predicate or POSSTR scalar function is not valid because the first operand is not a string expression or the second operand is not a string.

Cause: A LIKE predicate or POSSTR scalar function appearing in the statement is not valid because either the first operand is not a string expression or the second operand is not a string.

The operand appearing to the left of a LIKE or NOT LIKE predicate or the first operand of POSSTR must be a string expression. The value appearing to the right of the predicate or the second operand of POSSTR can be one of:

  • a constant
  • a special register
  • a host variable
  • a scalar function whose operands are any of the above
  • an expression concatenating any of the above

with the restrictions that:

  • no element in the expression can be of type LONG VARCHAR, CLOB, LONG VARGRAPHIC, or DBCLOB. In addition it cannot be a BLOB file reference variable.
  • the actual length of the expression cannot be more than 4000 bytes.

A LIKE predicate or POSSTR scalar function cannot be used with DATE, TIME, or TIMESTAMP.

The statement cannot be processed.

Action: Check and correct the syntax of LIKE and POSSTR

sqlcode: -132

sqlstate: 42824



SQL0134N Improper use of a string column, host variable, constant, or function "<name>".

Cause: The use of the string "<name>" is not permitted.

An expression resulting in a string data type with a maximum length greater than 254 bytes is not permitted in:

  • A SELECT DISTINCT statement
  • A GROUP BY clause
  • An ORDER BY clause
  • A column function with DISTINCT
  • A SELECT or VALUES statement of a set operator other than UNION ALL.

An expression resulting in a LONG VARCHAR or LONG VARGRAPHIC data type is not permitted in:

  • A predicate other than EXISTS or NULL
  • A column function
  • The SELECT clause of a subquery of a predicate other than EXISTS or NULL
  • The SELECT clause of a subselect in an INSERT statement
  • The value expression of a SET clause in an UPDATE statement unless the expression is a LONG VARCHAR or LONG VARGRAPHIC host variable
  • A SELECT statement of a set operator (except UNION ALL)
  • VARGRAPHIC scalar function.

DataJoiner users: in a pass-through session, a data source-specific restriction can cause this error.

The statement cannot be processed.

Action: The requested operation on the string is not supported.

Note: If it is unclear as to how the 254 byte limit is being exceeded, consider that codepage conversion operations may be required to evaluate the string expression. Depending on the source and target codepages, the target may have a greater length attribute than the source. For more information, refer to the SQL Reference for discussions on string restrictions and string conversions.

sqlcode: -134

sqlstate: 42907



SQL0137N The length resulting from "<operation>" is greater than "<maximum value>".

Cause: The result of concatenating the given operands was longer than what is supported by the result type.

Character string results are limited to 32,700 bytes unless one of the operands is a CLOB and then the limit is 2 gigabytes.

Graphic string results are limited to 16,350 characters unless one of the operands is a DBCLOB and then the limit is 1,073,741,823 (1 less than 1 gigabyte) double byte characters.

Binary string results (operands are BLOB) are limited to 2 gigabytes.

Action: Ensure that the sum of the lengths of the operands does not exceed the supported maximum and try the operation again.

sqlcode: -137

sqlstate: 54006



SQL0138N The second or third argument of the SUBSTR function is out of range.

Cause: One of the following conditions occurred:

  • The second argument of the SUBSTR function is less than 1 or greater than M.
  • The third argument of the SUBSTR function is an expression with a value less than 0 or greater than M-N+1.

M is the length of the first argument if it is fixed length or the maximum length of the first argument if it is varying length. N is the value of the second argument.

The statement cannot be processed.

Action: Ensure that the second and third arguments of the SUBSTR function have values that conform to the above rules.

sqlcode: -138

sqlstate: 22011



SQL0139W A redundant clause appears in the specification for column "<column>".

Cause: The clause in the column specification is redundant.

The statement was processed successfully, but the redundant clause was ignored.

Action: Correct the column specification.

sqlcode: +139

sqlstate: 01589



SQL0142N The SQL statement is not supported.

Cause: An embedded SQL statement that may be valid for other IBM relational database products is not supported by the database manager.

DataJoiner users: check to see if an SQL statement was directed at a data source that does not support the SQL statement.

The statement cannot be processed.

Action: Change the syntax of the SQL statement or remove the statement from the program.

DataJoiner users: if the reason is unknown, isolate the problem to the data source failing the request (see the Problem Determination Guide for procedures to follow to identify the failing data source) and examine the SQL dialect for that data source.



SQL0143W The SQL statement is not supported; invalid syntax is ignored.

Cause: An embedded SQL statement that may be valid for other IBM relational database products is understood but is not supported by the database manager.

The statement may produce inconsistent or unwanted results.

Action: Change the syntax of the SQL statement or remove the statement from the program.



SQL0150N The view or summary table in the INSERT, DELETE, or UPDATE statement is a view or summary table for which the requested operation is not permitted.

Cause: The view or summary table named in the INSERT, UPDATE, or DELETE statement is defined so that the requested insert, update, or delete operation cannot be performed.

A view is read only if the SELECT statement contains any of the following:

  • A DISTINCT keyword
  • A column function in the select list
  • A GROUP BY or HAVING clause
  • A FROM clause that identifies one of the following:
    • More than one table or view
    • A read-only view (READONLY column of SYSCAT.SYSVIEWS is set to 'Y')
    • A table or view that is also identified in the FROM clause of a subquery of the SELECT statement. (NOTE: This only applies to releases prior to DB2 Version 2.)
  • A set operator (other then UNION ALL).
  • DataJoiner users: a data source specific limitation that causes the column not to be updateable

Note that these conditions do not apply to subqueries of the SELECT statement.

Summary tables do not allow the insert, update or delete operations.

The statement cannot be processed.

Action: The requested function cannot be performed on the view or summary table.

DataJoiner users: if the reason is unknown, isolate the problem to the data source failing the request (see the Problem Determination Guide for procedures to follow to identify the failing data source) and examine the object definition and the update restrictions for that data source.

sqlcode: -150

sqlstate: 42807



SQL0151N The column "<name>" cannot be updated.

Cause: The specified column cannot be updated because one of the following was attempted.

  • the object table is a view, and the specified column is derived from a scalar function, expression, keyword, constant, or column of a view where that column cannot be updated.
  • the specified column is a non-updateable column of a system catalog.

DataJoiner users should check to see if:

  • The column is not an updateable column. See section on "System Catalog Views", in the IBM DataJoiner Application Programming and SQL Reference Supplement for a description of the system catalog tables and which columns are updateable.
  • Some other data source specific limitation prevents the column from being updated.

Some DataJoiner data sources do not provide the appropriate values for the "<name>". In these cases the appropriate fields contain values (such as "unknown") that indicate that the actual value is unknown.

The statement cannot be processed.

Action: The requested function is not supported. For a list of updateable catalogs (and the updateable columns) see the SQL Reference.

DataJoiner users: if the reason is unknown, isolate the problem to the data source failing the request (see the Problem Determination Guide) and examine the object definition and the update restrictions for that data source.

sqlcode: -151

sqlstate: 42808



SQL0153N The CREATE VIEW statement or common table expression does not include a column list.

Cause: A column list must be specified in a CREATE VIEW statement or a common table expression when:

  • any element of the SELECT list in the fullselect is other than a column name and is not named using the AS clause
  • any two elements are the same column name that were not renamed using the AS clause.

The statement cannot be processed. For a CREATE VIEW statement, the view was not created.

Action: Provide a column name list in the CREATE VIEW statement or common table expression or name the columns in the SELECT list of the fullselect using the AS clause.

sqlcode: -153

sqlstate: 42908



SQL0155N A trigger transition table cannot be modified.

Cause: The trigger includes a REFERENCING clause with an OLD_TABLE or NEW_TABLE identified. A DELETE, INSERT or UPDATE triggered SQL statement has used the name specified as the OLD_TABLE or NEW_TABLE as the table to modify.

Action: Remove the DELETE, INSERT or UPDATE triggered SQL statement from the triggered action or change the name of the transition table so that it does not conflict with the table you are attempting to modify.

sqlcode: -155

sqlstate: 42807



SQL0156N The name used for this operation is not a table.

Cause: The SQL statements ALTER TABLE, DROP TABLE, SET CONSTRAINTS, CREATE TRIGGER, CREATE INDEX, LOCK TABLE, and RENAME TABLE are applicable only to tables, not to views. The RUNSTATS and LOAD utilities are also applicable only to tables, not to views.

DataJoiner users: ALTER TABLE and DROP TABLE are not allowed on nicknames.

The statement or utility cannot be processed.

Action: Verify that the correct table name is specified in the statement. If an alias name was supplied, ensure that the alias resolves to a table.

DataJoiner users: if the statement is an ALTER TABLE or DROP TABLE statement, verify that the object is not a nickname.

sqlcode: -156

sqlstate: 42809



SQL0157N "<name>" is not allowed in a FOREIGN KEY clause because it identifies a view.

Cause: The view "<name>" was identified in a FOREIGN KEY clause of a CREATE or ALTER TABLE statement. A FOREIGN KEY clause must identify a table, not a view.

The statement cannot be processed. The specified table is not created or altered.

Action: Correct the statement to specify a table name in the FOREIGN KEY clause.

If an alias name was supplied, ensure that the alias resolves to a table.

sqlcode: -157

sqlstate: 42810



SQL0158N The number of columns specified for "<name>" is not the same as the number of columns in the result table of the associated fullselect.

Cause: The identifier "<name>" could identify:

  • a view named in a CREATE VIEW statement
  • a table name of a common table expression
  • a correlation name of a nested table expression.

The number of column names specified must be equal to the number of columns in the result table of the associated fullselect.

The statement cannot be processed.

Action: Correct the syntax so that the list of column names that immediately follow "<name>" specify a name for each column of the result table in the associated fullselect.

sqlcode: -158

sqlstate: 42811



SQL0159N The statement references "<object>" which identifies a(n) "<object-type>" rather than a(n) "<expected-object-type>".

Cause: The object "<object>" specified as part of the statement or command refers to an object of type "<object-type>" instead of the expected type "<expected-object-type>".

The type of the object provided with the statement or command must match the type identified by "<expected-object-type>". For example, if the statement is DROP ALIAS PBIRD.T1, then PBIRD.T1 must be an alias name.

Action: Change the statement or command to properly match the type of object identified by "<expected-object-type>".

sqlcode: -159

sqlstate: 42809



SQL0160N The WITH CHECK option is not valid for the specified view.

Cause: The WITH CHECK option cannot be used in a view definition if:

  • The view is defined as read only. The view is read only if the SELECT statement contains any of the following. (Note that these conditions do not apply to subqueries of the SELECT statement.)
    • A DISTINCT keyword
    • A column function in the selected list
    • A GROUP BY or HAVING clause
    • A FROM clause that identifies either:
      • More than one table or view
      • A read-only view
    • A set operator (other than UNION ALL).
  • The SELECT statement in the CREATE VIEW statement includes a subquery (except for specific statistic columns of some catalog tables).

The statement cannot be processed. The specified view was not created.

Action: Remove the WITH CHECK option or change the view definition so it conforms to the rules above.

sqlcode: -160

sqlstate: 42813



SQL0161N The resulting row of the INSERT or UPDATE does not conform to the view definition.

Cause: The WITH CHECK option was specified in the view definition 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 conform to the view definition.

The statement cannot be processed. No inserts or updates are performed, and the contents of the view and underlying base table remain unchanged.

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

Requested INSERT or UPDATE may be trying to put out of range value(s) in the target column(s). For system catalog updates, see the SQL Reference for valid ranges of values in various updateable columns of catalogs.

DataJoiner users, if the reason is unknown, isolate the problem to the data source failing the request (see the Problem Determination Guide) and examine the object definition and the view definition for that data source.

sqlcode: -161

sqlstate: 44000



SQL0170N The number of arguments for function "<name>" is incorrect.

Cause: The specified scalar function "<name>" has either too few or too many arguments.

The statement cannot be processed.

Action: Ensure that the correct number of arguments is specified for the scalar function.

sqlcode: -170

sqlstate: 42605



SQL0171N The data type, length or value of argument "<n>" of function "<name>" is incorrect.

Cause: The data type, length or value of argument "<n>" of scalar function "<name>" is incorrect.

The statement cannot be processed.

Action: Ensure the arguments of the scalar function conform to the function rules.

sqlcode: -171

sqlstate: 42815



SQL0172N "<name>" is not a valid function name.

Cause: The SQL statement includes an unknown scalar function.

The statement cannot be processed.

Action: Ensure that you correctly spell the function name.

sqlcode: -172

sqlstate: 42601



SQL0176N The second, third or fourth argument of the TRANSLATE scalar function is incorrect.

Cause: The statement is not correct for one or more of the following reasons:

  • The translate scalar function does not allow replacement of a character by another character which is encoded using a different number of bytes. For example, a single-byte character cannot be replaced with a double-byte character nor can a double-byte character be replaced with a single-byte character.
  • The second and third arguments of the translate scalar function must end with correctly formed characters.
  • The fourth argument of the translate scalar function must be a correctly formed single-byte character if the first argument is CHAR or VARCHAR.
  • The fourth argument of the translate scalar function must be a correctly formed double-byte character if the first argument is GRAPHIC or VARGRAPHIC.

The statement cannot be processed.

Action: Ensure that the second, third, and fourth arguments of the translate scalar function have correct values.

sqlcode: -176

sqlstate: 42815



SQL0180N The syntax of the string representation of a datetime value is incorrect.

Cause: The string representation of a date, time, or timestamp value does not conform to the syntax for the specified or implied data type.

The statement cannot be processed.

Action: Ensure that the syntax of the date, time, or timestamp value conforms to the syntax for its data type. If the string is not intended to be a date, time, or timestamp value, ensure that when used, it does not imply that data type.

DataJoiner users: the problem might be due to a date/time representation problem at the DataJoiner data source. If the reason is unknown, isolate the problem to the data source failing the request (see the Problem Determination Guide) and examine the date/time representation restrictions for that data source.

sqlcode: -180

sqlstate: 22007



SQL0181N The string representation of a datetime value is out of range.

Cause: The string representation of a date, time or timestamp value contains a value that is out of range.

This error could be caused by accessing a datetime value from an application using a country code whose datetime format is different than the one used by the application that created it. For example, a string datetime value stored in the format dd/mm/yyyy will not be valid when read by an application expecting its format to be mm/dd/yyyy.

The correct ranges for date, time, or timestamp values are as follows:

  • 0001 to 9999 for years.
  • 1 to 12 for months.
  • 1 to 31 for days when the month is 1, 3, 5, 7, 8, 10, and 12.
  • 1 to 30 for days when the month is 4, 6, 9, 11.
  • 1 to 28 for days when the month is 2 in a non-leap year.
  • 1 to 29 for days when the month is 2 in a leap year.
  • 0 to 24 for hours. If the hour is 24, the other parts of the time are 0. If the format is USA, the hour cannot be greater than 12.
  • 0 to 59 for minutes.
  • 0 to 59 for seconds.
  • 0 to 999999 for microseconds.
  • 001 to 365 for the day portion of a Julian calendar date when the year is not a leap year.
  • 001 to 366 for the day portion of a Julian calendar date when the year is a leap year.

DataJoiner users: the problem might be due to a date/time representation problem at the data source. Refer to the data source's documentation for the ranges for date and time values at the data source. If the reason is unknown, isolate the problem to the data source failing the request (see the Problem Determination Guide) and examine the date/time representation restrictions for that data source.

The statement cannot be processed.

Action: Ensure that the value is within the valid range, and the application's datetime format is the same as the string value.

sqlcode: -181

sqlstate: 22007



SQL0182N An expression with a datetime value or a labeled duration is not valid.

Cause: The specified expression contains an improperly used date, time, or timestamp value or labeled duration.

The statement cannot be processed.

Action: Examine the SQL statement to determine the cause of the problem and correct the statement.

sqlcode: -182

sqlstate: 42816



SQL0183N A datetime arithmetic operation or datetime scalar function has a result that is not within the valid range of dates.

Cause: The result of an arithmetic operation is a date or timestamp duration which is outside the range 0001-01-01 through 9999-12-31.

The statement cannot be executed.

Action: Examine the SQL statement to determine the cause of the problem. If the problem is data-dependent, examine the data processed when the error occurred.

sqlcode: -183

sqlstate: 22008



SQL0187N A reference to a current date/time special register is invalid.

Cause: An error indication from the operating system was detected while retrieving date/time information.

Action: Ensure that the system TOD clock and timezone settings are correct.

sqlcode: -187

sqlstate: 22506



SQL0190N In table "<table-name>", column "<column-name>" cannot be altered because the data type or length of the existing column is incompatible.

Cause: The column "<column-name>" as currently defined in "<table-name>":

  • is not of data type VARCHAR or
  • has a length that is greater than the length specified in the SET DATA TYPE clause

The statement cannot be processed.

Action: If the column is not a VARCHAR data type, the data type and length cannot be changed. If the length value specified was less than the existing column length, specify a larger value.

sqlcode: -190

sqlstate: 42837



SQL0191N MBCS conversion error occurred because of a fragmented MBCS character.

Cause: The data contained an improperly formed multi-byte character. For example, the first byte of a DBCS character was found, but the second character was not.

DataJoiner users: this situation can be detected by DataJoiner or by the data source.

Action: Correct the input data and try again.

DataJoiner users: if the data is correct, isolate the problem to the data source failing the request (see the Problem Determination Guide) and examine the DBCS restrictions of that data source. If the data appears to be correct, contact IBM service for assistance.

sqlcode: -191

sqlstate: 22504



SQL0193N In an ALTER TABLE statement, the column "<column-name>" has been specified as NOT NULL and either the DEFAULT clause was not specified or was specified as DEFAULT NULL.

Cause: When new columns are added to a table that already exists, a value must be assigned to that new column for all existing rows. By default, the null value is assigned. However, since the column has been defined as NOT NULL, a default value other than null must be defined.

Action: Either remove the NOT NULL restriction on the column or provide a default value other than null for the column.

sqlcode: -193

sqlstate: 42601



SQL0197N A qualified column name is not allowed in the ORDER BY clause.

Cause: The ORDER BY clause of a fullselect that includes a set operator (UNION, EXCEPT, INTERSECT) cannot have qualified column names.

Action: Ensure that all column names in the ORDER BY clause are unqualified.

sqlcode: -197

sqlstate: 42877



SQL0198N The statement string of the PREPARE or EXECUTE IMMEDIATE statement is blank or empty.

Cause: The host variable that was the object of the PREPARE or EXECUTE IMMEDIATE statement either contained all blanks or was an empty string.

The PREPARE or EXECUTE IMMEDIATE could not be completed.

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

sqlcode: -198

sqlstate: 42617



SQL0199N The use of reserved word "<keyword>" following "<text>" is not valid. Expected tokens may include: "<token-list>".

Cause: A syntax error in the SQL statement was detected at the point in the statement when the reserved word "<keyword>" appears following "<text>". The "<text>" field indicates the 20 characters of the SQL statement that preceded the reserved word. Clauses in the statement may be in the wrong order.

As an aid to the programmer, a partial list of valid tokens is provided in the SQLERRM field of the SQLCA as "<token-list>". This list assumes the statement is correct to that point.

The statement cannot be processed.

Action: Examine the statement in the keyword area. Add a colon or SQL delimiter, if missing. Verify that the clauses are in the correct order. If the reserved word identified in the messages is listed as a reserved word, make the word a delimited identifier.

NOTE: This error is only applicable to releases of DB2 prior to Version 2.

sqlcode: -199

sqlstate: 42601




[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]

Expected Tokens May Include Database Alias Sqlstate 42601

Source: https://www.columbia.edu/sec/acis/db2/db2m0/sql0100.htm

0 Response to "Expected Tokens May Include Database Alias Sqlstate 42601"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel