Working with Null Values

The NullRequired item specifies the mandatory status of a column. This item is used with the NULLNOTNULL column variable, which can take the "null", "not null" or empty values. The following combinations are available

When the Column Is Mandatory

"not null" is always generated whether NullRequired is set to True or False as shown in the following example:

create domain DOMN_MAND char(33) not null;
create domain DOMN_NULL char(33)   null;

create table TABLE_1 
(
 COLN_MAND_1 char(33)  not null,
 COLN_MAND_2 DOMN_MAND not null,
 COLN_MAND_3 DOMN_NULL not null,
);

When the Column Is not Mandatory

  • If NullRequired is set to True, "null" is generated. The NullRequired item should be used in ASE for example, where nullability is a database option, and the "null" or "not null" keywords are required.

    In the following example, all "null" values are generated:

create domain DOMN_MAND char(33) not null;
create domain DOMN_MAND char(33)   null;

create table TABLE_1 
(
 COLN_NULL_1 char(33)  null,
 COLN_NULL_2 DOMN_NULL   null,
 COLN_NULL_3 DOMN_MAND   null
)
  • If NullRequired is set to False, an empty string is generated. However, if a column attached to a mandatory domain becomes non-mandatory, "null" will be generated.

    In the following example, "null" is generated only for COLUMN_NULL3 because this column uses the mandatory domain, the other columns generate an empty string:

create domain DOMN_MAND char(33) not null;
create domain DOMN_NULL char(33)   null;

create table TABLE_1 
(
 COLUMN_NULL1 char(33)    ,
 COLUMN_NULL2 DOMN_NULL   ,
 COLUMN_NULL3 DOMN_MAND   null
);