DB2 SQL Errors Codes and Error Messages and Warnings from Error -546 to -549

SQLServerF1

Error: DB2 SQL Error: SQLCODE=-546, SQLSTATE=42621, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE CHECK CONSTRAINT
constraint-name IS INVALID
Explanation: A check constraint in the CREATE
TABLE or ALTER TABLE statement is invalid for one
or more of the following reasons:
v The constraint definition refers to a column that has
a field procedure.
v The constraint definition refers to a column with a
data type that is lower in the hierarchy of numeric
data types than the data type
small integer < large integer < decimal
< single precision float
< double precision float
v The constraint definition refers to a column with a
numeric data type that is not the same numeric data
type as that of the other column operands.
v The constraint definition refers to a column with a
length that is shorter than the other operands when
the column and other operands are not character
string data types.
v The constraint definition refers to a built-in or
user-defined function.
v The constraint definition uses a cast function that
requires conversion of the data. The only functions
that are allowed in a check constraint are cast
functions that do not require conversion of the data.
v The constraint contains an XML column
v The constraint definition contains an XMLQuery
expression.
v The constraint definition refers to a DECFLOAT
column.
System action: The statement is not executed.
For ALTER TABLE, the check constraint is not added to
the object table. The definition of the table is
unchanged.
For CREATE TABLE, the table is not created.
Programmer response: Correct the check constraint
definition and execute the statement again.
SQLSTATE: 42621

Error: DB2 SQL Error: SQLCODE=-548, SQLSTATE=42621, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
A CHECK CONSTRAINT THAT IS
DEFINED WITH column-name IS
INVALID
Explanation: A check constraint in the CREATE
TABLE or ALTER TABLE statement is invalid for one
or more of the following reasons:
v The constraint definition refers to a column that has
a field procedure.
v The constraint definition refers to a column with a
data type that is lower in the hierarchy of numeric
data types than the data type of any other operand.
The hierarchy is as follows:
small integer < large integer < big integer
< decimal < single precision float
< double precision float
v The constraint definition refers to a column with a
numeric data type that is not the same numeric data
type as that of the other column operands.
v The constraint definition refers to a column with a
length that is shorter than the other operands when
the column and other operands are not character
string data types.
v The constraint definition refers to a ROWID column.
v The constraint definition refers to a LOB column.
v The constraint contains an XML column.
v The constraint definition contains an XMLQuery
expression.
v The constraint definition refers to a DECFLOAT
column.
v An XMLQUERY or XMLEXISTS argument list
contained two arguments with the same name.
System action: The statement is not executed.
For ALTER TABLE, the check constraint is not added to
the object table. The definition of the table is
unchanged.
For CREATE TABLE, the table is not created.
Programmer response: Correct the check constraint
definition and execute the statement again.
SQLSTATE: 42621

Error: DB2 SQL Error: SQLCODE=-549, SQLSTATE=42509, SQLERRMC=TBSPACEID=, TABLEID=, COLNO=, DRIVER=
THE statement STATEMENT IS NOT
ALLOWED FOR object_type1 object_name
BECAUSE THE BIND OPTION
DYNAMICRULES(RUN) IS NOT IN
EFFECT FOR object_type2
Explanation: A program attempted to issue the
indicated SQL statement that is one of several SQL
statements that cannot be issued from a plan or
package for which the option DYNAMICRULES(RUN)
is not in effect. Those SQL statements are:
v Dynamic GRANT statement
v Dynamic REVOKE statement
v Dynamic ALTER statement
v Dynamic CREATE statement
v Dynamic DROP statement
The indicated SQL statement is bound to one of the
following:
v The named plan or package that was not bound with
the option DYNAMICRULES(RUN)
v The named package that was not bound with the
DYNAMICRULES option, but is appended to a plan
that was not bound with DYNAMICRULES(RUN)
statement
The SQL statement in error
object_type1
PACKAGE or DBRM
object_name
If object_type1 is PACKAGE, object_name is the
name of the package in the format
‘location-id.collection-id.package-id’.
If object_type1 is DBRM, object_name is the
name of the DBRM in the format ‘plan-name
DBRM-name’.
object_type2
PLAN or PACKAGE
If object_type1 is PACKAGE, object_type2 can be
either PACKAGE or PLAN (whichever is
bound with a DYNAMICRULES value other
than RUN).
If object_type1 is DBRM, object_type2 is PLAN.
System action: The SQL statement cannot be executed.
Programmer response: Do one of the following to
correct the error:
v If the SQL statement is embedded, remove it,
precompile and compile the application program
again, and reissue the BIND command with the
desired DYNAMICRULES option.
v If appropriate, use the SQL statement with a package
or plan that is bound with DYNAMICRULES(RUN).
v Issue the REBIND command with the
DYNAMICRULES(RUN) option for the plan or
package to which the SQL statement is bound
Refer to the BIND PACKAGE(DSN), BIND
PLAN(DSN), REBIND PACKAGE(DSN), or REBIND
PLAN(DSN) statement in Command Reference for the
description of the DYNAMICRULES option and the
expected results. Determine if either the SQL statement
should be removed from the program or the plan or
package should be rebound with the
DYNAMICRULES(RUN) option.
SQLSTATE: 42509

Above are list of DB2 SQL Errors and Warnings from Error -546 to -549 received while performing certain operation against DB2 Database or related products.

SQLCODE – Regardless of whether the application program provides an SQLCA or a stand-alone variable, SQLCODE is set by DB2 after each SQL statement is
executed. DB2 conforms to the ISO/ANSI SQL standard as follows:
If SQLCODE = 0, execution was successful.
If SQLCODE &gt; 0, execution was successful with a warning.
If SQLCODE &lt; 0, execution was not successful.
SQLCODE = 100, “no data” was found. For example, a FETCH statement returned no data because the cursor was positioned after the last row of the result table.

SQLSTATE – SQLSTATE is also set by DB2 after the execution of each SQL statement. Thus, application programs can check the execution of SQL statements by testing SQLSTATE instead of SQLCODE.

Hope this was helpful.

Thanks,
SQLServerF1 Team
Information about DB2 SQL Error Codes and Error Messages on Windows, Linux and Z/OS Operating Systems.

 

Leave a Reply

Your email address will not be published. Required fields are marked *