Syntax Rules for Column Descriptions
<null_assign> ::= [IF] NULL SET '<valLITERAL>'
valLITERAL |
Null value representation |
Place the value for the null representation in single quotation marks.This is a plain text value that the Loader represents as a character string or binary numeric value. This depends on the external data type of the column for which you want to generate the null value.
If you want to display the null value representation in one of the external data types for binary values, it must have a valid numeral format. This means either a floating decimal number in mantissa/exponent representation, or a fixed point number with the currently agreed or standard decimal setting.
The generated null value representation is written to the same place in the data stream as the actual column value.
· If the null value representation is shorter than the length of the value specified by the position, the value is filled with blank characters. If the null value representation is longer, it is shortened to the specified length, and the Loader generates a warning.
· If columns in the target table permit NULL values and you have not specified a null value representation, the Loader default is used for unloaded NULL values (null_spec). This has the external data type CHAR.
· If you define a null value representation for unloading NOT-NULL columns, it does not cause an error.
You use this syntax rule in a command for unloading data, to specify which value for the data field of the source table is written to the data stream if the value in the source table is a NULL value.
You want to unload the source table article from the database instance into the data stream article.data. Some of the columns in the table contain NULL values.
Define a separate condition for each of these columns.
If this condition is met, the corresponding null value representation is
entered in the data stream.
DATAEXTRACT * FROM article
OUTFIELDS
ano 01-08
descr 09-39 IF NULL SET ' '
stock 40-43 INTEGER IF NULL SET '0'
min_ord 44-45 INTEGER
price 46-53 DECIMAL
(2) IF NULL SET 'X'
weight 54-57 REAL
OUTSTREAM 'article.data' FORMATTED
You want to unload the source table article from the database instance into the data stream article.data. Some of the columns in the table contain NULL values.
Because there is no null value representation defined for the column in the
command, but all values have the external data type CHAR, the Loader default
null value representation '?' is used.
DATAEXTRACT * FROM article
OUTFIELDS
ano 01-08
descry 09-39
stock 40-51
min_ord 52-63
price 64-74
weight 75-85
OUTSTREAM 'article.data' FORMATTED
You want to unload the source table article from the database instance into the data stream article.data. Some of the columns in the table contain NULL values.
Because there is no null value representation defined for the column in the
command, the Loader attempts to use the null value representation defined as a
default (data type CHAR).This causes an error if a numeric external data type has been defined for the
columns.
The command terminates with an error message.
DATAEXTRACT * FROM article
OUTFIELDS
ano 01-08
descr 09-39
stock 40-43 INTEGER
min_ord 44-45 INTEGER
price 46-53 DECIMAL (2)
weight 54-57 REAL
OUTSTREAM 'article.data' FORMATTED