Assigning a NULL Value to a Column

From InterBase
Jump to: navigation, search

When a specific value is not provided for a column on insertion, it is standard SQL practice to assign a NULL value to that column. In InterBase a column is set to NULL by specifying NULL for the column in the INSERT statement.

For example, the following statement stores a row into the DEPARTMENT table, assigns the values of host variables to some columns, and assigns a NULL value to other columns:

EXEC SQL
INSERT INTO DEPARTMENT
(DEPT_NO, DEPARTMENT, HEAD_DEPT, MNGR_NO, BUDGET,
LOCATION, PHONE_NO)
VALUES (:dept_no, :dept_name, NULL, NULL, 1500000, NULL, NULL);