Entering content frame

 null_condition 

Syntax Rules for Column Descriptions

Syntax

<null_condition> ::= NULL [IF] <condition> | DEFAULT NULL

Explanation

When the condition is evaluated, the shorter of the comparison values (value in the data stream or the null value representation) is filled with blank characters.

A check is made before each line in the data stream is loaded to see whether the condition formulated for the columns applies. If it does, the NULL value is inserted in this column. If not, the value from the assigned field in the data stream is inserted.

Use

You use this syntax rule in a command for loading data, to specify the conditions under which the NULL value should loaded into a column of the target table.

You can use the DEFAULT-NULL condition if the NULL value in the data stream is represented in the same way for all columns that you want to load from the target table.The character string that you need to specify after NULL IF POS is only specified once as a NULL specification (null_spec) in the DEFAULT-NULL condition.

You cannot load columns defined as key columns (KEY) or NOT NULL with the NULL value.If you do, the table load action terminates with a corresponding error message.

If, when you created the table in the database instance, you defined a default other than NULL for columns, you cannot load NULL values into the columns.In this case, the Loader uses the default value defined for the column instead of the NULL value.

You want to load the data from the data stream article.data into the database instance. You want to load the NULL value into some columns of the target table. Define a separate condition for each of these columns.The NULL value is entered if this condition is met.

DATALOAD TABLE article
  ano       01-08
  descr     09-39            
NULL IF POS 09-11 = '   '
  stock     40-43 INTEGER    
NULL IF POS 40-43 INTEGER < '0'
  min_ord   44-45 INTEGER
  price     46-53 DECIMAL (2) 
NULL IF POS 1 <> 'X'
                                  
OR POS 46-53 DECIMAL < '0'
  weight    54-57 REAL
INSTREAM 'article.data' FORMATTED

You want to load the data from the data stream article.data into the database instance. You want to load the NULL value into some columns of the target table. The same '?'representation of the NULL value applies to all columns in the command where DEFAULT NULL is specified.

DATALOAD TABLE article
  ano       01-08
  descr     09-39 DEFAULT NULL
  stock     40-43 INTEGER
DEFAULT NULL
  min_ord   44-45 INTEGER
  price     46-53 DECIMAL (2)
DEFAULT NULL
  weight    54-57 REAL
INSTREAM 'article.data' FORMATTED
NULL '?'

 

Leaving content frame