Syntax
<load_column_spec_mlt> ::= /* leer */
|
Use
This is a
syntax rule for describing columns.Use it in a
command for loading data to describe the data records you want to load from a source file and their assignment to the columns of the target table.Table definition:
create table customer (cno char (4), surname char (6) NOT NULL, zip integer, place char (11), PRIMARY KEY (cno))
Load command:
DATALOAD TABLE customer
cno 01-04
last name 06-12
zip 14-18
place 20-31
INFILE 'customer.data' FORMATTED
Rules
Data must exist in the source file for each column that you specify in the data load command.
If you do not specify columns in the target table in the command, the entire column is populated with the default value defined for this column during the load operation. The NULL value is loaded if no specific default value is defined for the column.
DATALOAD TABLE customer
cno 01-04
last name 06-12
INFILE 'customer.data' FORMATTED
zip and place are populated with the default value when the data is loaded
Key columns and mandatory columns (columns that are defined as NOT NULL without a default value) must be specified in the data load command. Otherwise, the command terminates with an SQL error.
DATALOAD TABLE customer
last name 06-12
zip 14-18
place 20-31
INFILE 'customer.data' FORMATTED
The command terminates with an SQL error.
If you do not specify any columns for the target table in the data load command, the table is loaded as if all columns in the target table were specified in the command. If this is the case, data must exist in the source file for all of the columns in the target table.
DATALOAD TABLE customer
INFILE 'customer.data' FORMATTED
Data must exist in the source file for all of the columns in the target table.