trailing option in ctl file [message #387637] |
Fri, 20 February 2009 02:55 |
swas_fly
Messages: 220 Registered: March 2008 Location: Bhubaneswar
|
Senior Member |
|
|
LOAD DATA
infile '/path/sample.csv'
truncate
INTO TABLE scott.base_table
fields terminated by ',' optionally enclosed by '"' trailing nullcols
( NO "TRIM(:SITE_NO)",
ID "TRIM(:ORG_ID)",
TEL_NO "TRIM(:ADSL_TEL_NO)",
DESC "TRIM(:PROD_DESC)",
PRODUCT_START_DATE DATE "YYYY-MM-DD HH24:MI:SS",
SALES_CHANNEL "TRIM(:SALES_CHANNEL)"
)
Please let me know how will this trailing nullcols work?
Thanks
|
|
|
|
Re: trailing option in ctl file [message #387648 is a reply to message #387637] |
Fri, 20 February 2009 03:22 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
From the documentation
Quote: | TRAILING NULLCOLS Clause
The TRAILING NULLCOLS clause tells SQL*Loader to treat any relatively positioned columns that are not present in the record as null columns.
For example, consider the following data:
10 Accounting
Assume that the preceding data is read with the following control file and the record ends after dname:
INTO TABLE dept
TRAILING NULLCOLS
( deptno CHAR TERMINATED BY " ",
dname CHAR TERMINATED BY WHITESPACE,
loc CHAR TERMINATED BY WHITESPACE
)
In this case, the remaining loc field is set to null. Without the TRAILING NULLCOLS clause, an error would be generated due to missing data.
|
|
|
|