Purpose of NOT NULL with DEFAULT Clause 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: 2020-09-14T15:02:16+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements