Setting the Date Format in the SQL*Loader Control File
Asked Answered
C

1

7

I have csv file that has "17 September, 2009 11:06:06 AM" as COMPLETED_ON variable

I am using sql loader to load data to oracle with folowing:

LOAD DATA
INFILE 'c:/load/file_name.csv'
APPEND
INTO TABLE tbl_name
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(
COMPLETED_ON DATE "not sure what to put here",
) 

in oracle I have this column created as follows:

"COMPLETED_ON" TIMESTAMP (0) WITH LOCAL TIME ZONE

How do I change COMPLETED_ON date in control file?

Codon answered 16/5, 2013 at 19:11 Comment(1)
If Ed Gibbs' answer solved your problem, please accept his answer. Thanks!Parallelize
F
15

I'm not 100% with the LOAD DATA INFILE syntax, but I know the format string 'DD Month, YYYY HH:MI:SS AM' matches your date format. I was able to use it in a TO_DATE to convert your sample date. Try this:

LOAD DATA
INFILE 'c:/load/CW_COMPLIANCE.csv'
APPEND
INTO TABLE tbl_name
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(
COMPLETED_ON DATE 'DD Month, YYYY HH:MI:SS AM',
)
Forerun answered 16/5, 2013 at 19:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.