Learn it on Mainframe Path. Do it with Mainframe KIT.Learn on Mainframe Path ▸
Mainframe KIT ● Nothing leaves this tab

-407

Null assigned to a NOT NULL columnNEGATIVE SQLCODE · CHECKED 2026-11-14
Checked against IBM documentation

A NULL was assigned to a NOT NULL column, or a NOT NULL column without a default was left out of the INSERT or view.

QUICK ANSWER

A NULL was assigned to a NOT NULL column, or a NOT NULL column without a default was left out of the INSERT or view.

LIKELY CAUSES, IN THE ORDER OF THIS ENTRY

  1. A null INSERT or UPDATE value is given for a NOT NULL column.
  2. A SET transition variable statement sets NULL for a NOT NULL column without WITH DEFAULT.
  3. DEFAULT is used for a NOT NULL column declared without WITH DEFAULT.
  4. The INSERT column list, or the view used, omits a NOT NULL column without WITH DEFAULT.
  5. A null insert value is given for a ROWID column.

CHECKED 14 Nov 2026 IBM: Db2 13 - Codes - SQLCODE -407 | Db2 for z/OS 13.0.0

MOST LIKELY

A null INSERT or UPDATE value is given for a NOT NULL column.

FIRST CHECK

Look at the table definition to find columns that are NOT NULL or of type ROWID.

TRY IT ▸

Site search

What it means

The column named in the message cannot hold NULL, but the statement tried to give it one, directly or through DEFAULT or by omitting it.

The statement is not processed.

Typical causes

  • A null INSERT or UPDATE value is given for a NOT NULL column.
  • A SET transition variable statement sets NULL for a NOT NULL column without WITH DEFAULT.
  • DEFAULT is used for a NOT NULL column declared without WITH DEFAULT.
  • The INSERT column list, or the view used, omits a NOT NULL column without WITH DEFAULT.
  • A null insert value is given for a ROWID column.

How to fix it

  1. Look at the table definition to find columns that are NOT NULL or of type ROWID.
  2. Correct the statement so each such column gets a valid non-null value or is supplied correctly.