Progress
Embedded SQL-92
Guide and Reference


INSERT Null Values by DEFAULT

In Progress SQL-92, the default value for a column is NULL if the column definition does not contain the DEFAULT clause.

EXAMPLE

The following CREATE TABLE example defines two columns with the NOT NULL specification:

CREATE TABLE employee (
     empno     INTEGER NOT NULL,
     ename     CHAR(10),
     job       CHAR(10),
     hiredate  DATE,
     sal       NUMERIC(10,2),
     commission  NUMERIC(10,2),
     deptno    INTEGER NOT NULL,
     projno    INTEGER
     ) ; 

For example, to insert a row for a new employee the INSERT statement could be:

EXEC SQL
     INSERT INTO employee (empno, ename, job, hiredate, sal, deptno)
     VALUES (8585, ’RALPH’, ’CLERK’, ’02/02/1999’, 12000, 10) ; 

When you execute this INSERT statement, the database inserts a NULL VALUE into the commission and projno columns.

You can restrict any type of column not to accept a NULL value by specifying NOT NULL in the CREATE TABLE statement for that column. If you create a unique index for a column, it can have at most one row with a NULL value in that column.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095