Home » RDBMS Server » Server Utilities » trailing option in ctl file (Oracle 10g,HP unix)
trailing option in ctl file [message #387637] Fri, 20 February 2009 02:55 Go to next message
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 #387646 is a reply to message #387637] Fri, 20 February 2009 03:18 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Maybe you should think about to FIRST read the documentation.

Regards
Michel
Re: trailing option in ctl file [message #387648 is a reply to message #387637] Fri, 20 February 2009 03:22 Go to previous message
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.
Previous Topic: How to load multiple files into the database using sql*loader?
Next Topic: Importing data from a TXT file into a table
Goto Forum:
  


Current Time: Mon Dec 23 20:16:54 CST 2024