What is the purpose of “NOT NULL WITH DEFAULT” clause used in DB2 table column?


When we define the DB2 table, we can declare any column as “NOT NULL” which means that in any case this column cannot store NULL value.

Now if we try to store a NULL value in this column in our COBOL-DB2 program using -1 value in the NULL indicator then our query will fail. In this case the SQLCODE field of SQLCA will give the error code as -407. As per the IBM documentation -407 error code states that−

“AN UPDATE, INSERT, OR SET VALUE IS NULL, BUT THE OBJECT COLUMN CANNOT CONTAIN NULL VALUES”.

Updated on: 14-Sep-2020

732 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements