COPY : Specifying Load
Metadata
In addition to choosing a parser option, COPY supports other
options to determine how to handle raw data.
These options are considered load metadata, and we can specify
metadata options in different parts of the COPY statement.
Following are the places where we can specify the load metadata:
- As a Column or Expression.
- As a Column Option.
- As a FROM level Option.
Following table shows Which option can be specified at what level.
Metadata Option
|
As a Column or Expression Option
|
As a
COLUMN OPTION
|
As a FROM
Level Option
|
DELIMITER
|
Y
|
Y
|
Y
|
ENCLOSED
BY
|
Y
|
Y
|
Y
|
ESCAPE
AS
|
Y
|
Y
|
Y
|
NULL
|
Y
|
Y
|
Y
|
TRIM
|
Y
|
|
Y
|
RECORD
TERMINATOR
|
|
|
Y
|
SKIP
|
|
|
Y
|
SKIP
BYTES
|
|
|
Y
(Fixed-width only)
|
TRAILING
NULLCOLS
|
|
|
Y
|
Notice that the NULL, ESCAPE,ENCLOSED
and DELIMITER (NEED) metadata options can be specified at all
the 3 levels.
The following precedence rules apply to all data loads:
- All column-level parameters override statement-level parameters.
- COPY uses the statement-level parameter if you do not specify a column-level parameter.
- COPY uses the default metadata values for the DELIMITER, ENCLOSED BY, ESCAPE AS, and NULL options if you do not specify them at either the statement- or column-level.
No comments:
Post a Comment