You are on page 1of 1

Chapter 2: Inserting 57

| ORDER ( ON | OFF ) -- default ON


| PCTFREE <free_percent>
| QUOTES ( ON | OFF ) -- default ON
| STRIP ( ON | OFF ) -- default ON
| WITH CHECKPOINT ( ON | OFF ) -- default OFF
<load_delimiter> ::= string literal 1 to 255 characters in length
<escape_character> ::= string literal exactly 1 character in length
<free_percent> ::= integer literal in the range 0 to 100
The target table name is required but the input name list is optional. If the input
name list is omitted, the layout of the input file is assumed to match the layout
of the table (i.e., there are the same number of input fields as there are columns
in the table, and they are arranged left to right in each input record in the same
order as the columns appear in the CREATE TABLE).
The default input file format is comma-delimited ASCII text with each line
representing a separate row. Here is an example of a simple LOAD TABLE
statement; note that the file specification uses a pair of backslashes to represent
each single backslash so there wont be any problems with how the escape char-
acter (\) is interpreted:
CREATE TABLE t1 (
key_1 INTEGER NOT NULL,
col_2 VARCHAR ( 100 ) NULL,
col_3 DECIMAL ( 11, 2 ) NULL,
col_4 TIMESTAMP NULL,
col_5 INTEGER NOT NULL,
PRIMARY KEY ( key_1 ) );

LOAD TABLE t1 FROM 'c:\\temp\\t1_a.txt';


Here are the four lines of data contained in the t1_a.txt file:
1,'Hello, World',67.89,2003-09-30 02:15PM,999
2, stripped string without quotes , 0 , , 0
3,,,,
4," double quoted padded string ",0,2003 9 30,-111
Heres what the four rows in t1 look like after the LOAD TABLE has run:
key_1 col_2 col_3 col_4 col_5
===== ==================================== ===== ======================= =====
1 'Hello, World' 67.89 2003-09-30 14:15:00.000 999
2 'stripped string without quotes' 0.00 NULL 0
3 NULL NULL NULL 0
4 ' double quoted padded string ' 0.00 2003-09-30 00:00:00.000 -111
The input name list can be used for three purposes: to change the order in which
input fields are applied to table columns, to skip columns for which there is no
corresponding input field, and to skip input fields that are not to be copied into
any column.
n To change the order, code the column names in the order in which the cor-
responding input fields actually appear in the file.
n To skip a column in the table, leave its name out of the list.
n To skip an input field, use "filler()" in its position in the input name list.
Here is an example of a LOAD TABLE using an explicit input name list; the
second input field is ignored, the third, fourth, and fifth input fields are applied
to col_4, col_3, and col_2 respectively, and no input field is provided for col_5:

You might also like