MainframeKit

-433

SQLSTATE 22001NEGATIVE SQLCODE

A value was too long for where it was going, and Db2 would have had to cut it short in a place where truncation is not allowed.

MOST LIKELY

A string literal in the SQL longer than the target column.

FIRST CHECK

Take the value from the message and work out which column, parameter or cast it was going to.

TRY IT ▸

MainframeKit assistant

What it means

When Db2 casts or adjusts a value to fit a target, such as a column in an INSERT or UPDATE SET, a function argument or an explicit CAST, it will not silently chop off characters in these cases. Instead the statement fails with -433 and the message shows the value that was too long. Binary values (FOR BIT DATA, BINARY, VARBINARY) appear as a quoted hex string followed by X.

Either the input is longer than intended, or the target is shorter than it needs to be. Db2 messages for this code report SQLSTATE 22001.

Typical causes

  • A string literal in the SQL longer than the target column.
  • An argument to a user-defined function longer than the function's parameter.
  • An explicit CAST to a shorter character or binary type.
  • Input data that has grown longer than the column was designed for.
  • A target column shortened, or a function parameter defined smaller than the data passed.

How to fix it

  1. Take the value from the message and work out which column, parameter or cast it was going to.
  2. If it is a literal in the SQL, shorten it.
  3. Otherwise compare the input length with the target length in the catalog (SYSIBM.SYSCOLUMNS or SYSPARMS).
  4. Decide whether the data is wrong (fix or trim it deliberately with SUBSTR) or the target is too small (ask for it to be lengthened).
  5. Rerun the statement after the change.