Syntax Rules for Column Descriptions
<null_condition> ::= NULL [IF] <condition > | DEFAULT NULL
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 this syntax rule in a command to load application data to specify the conditions under which the NULL value is loaded into a column of the target table.
You can use the DEFAULT-NULLcondition 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 POSis only specified once as a NULL specification (null_spec) in the DEFAULT-NULLcondition.
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 an appropriate 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. If this is the case, the SAP DB Loader uses the default defined for the column instead of the NULL value.
You want to load the data from the data stream article.datainto 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
INFILE 'article.data' FORMATTED
You want to load the data from the data stream article.datainto 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 NULLis 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
INFILE 'article.data' FORMATTED
NULL '?'