I'm trying to load data in to a database using SQL-Loader but I'm (as many others) having a problem with my time format. Due to my limited skills with SQL-Loader I've not been able to find a previous post that would aid me. So here goes.
The data that I'm trying to insert is:
"some text"|"some text"|"some text"|"23-APR-12 12.00.00.000000000 AM"|"some text"|"some text."|"TEXT"|"23-APR-12 12.00.00.000000000 AM"|"some text"|"some text"|"some text"|"some text"|0|
The CTL file looks like this:
OPTIONS (ERRORS=1586)
LOAD DATA
INFILE 'SOURCE.ldr' "str '{EOL}'"
APPEND
CONTINUEIF NEXT(1:1) = '#'
INTO TABLE "DATABASE_NAME"."TABLE"
FIELDS TERMINATED BY'|'
OPTIONALLY ENCLOSED BY '"' AND '"'
TRAILING NULLCOLS (
"DOMAIN" ,
"CONTEXT" ,
"KEY" ,
"CREATED" TIMESTAMP "DD-MON-RR HH.MI.SSXFF AM" ,
"DESCRIPTION" ,
"VALUE" ,
"TYPE" ,
"CHANGED" TIMESTAMP "DD-MON-RR HH.MI.SSXFF AM" ,
"CORPORATEENGLISHVALUE" ,
"CORPORATEVALUE" ,
"ENGLISHVALUE" ,
"OLDDBKEY" ,
"FAVOURITE" )
And the Table:
DOMAIN VARCHAR2(255 BYTE)
CONTEXT VARCHAR2(255 BYTE)
KEY VARCHAR2(255 BYTE)
CREATED TIMESTAMP(6)
DESCRIPTION VARCHAR2(255 BYTE)
VALUE VARCHAR2(4000 BYTE)
TYPE VARCHAR2(255 BYTE)
CHANGED TIMESTAMP(6)
CORPORATEENGLISHVALUE VARCHAR2(4000 CHAR)
CORPORATEVALUE VARCHAR2(4000 CHAR)
ENGLISHVALUE VARCHAR2(4000 CHAR)
OLDDBKEY VARCHAR2(35 BYTE)
FAVOURITE NUMBER(1,0)
And the Oracle database has these NLS:
Date Format: RRRR-MM-DD
Timestamp Format: RRRR-MM-DD HH24:MI:SSXFF
Timestamp TZ Format: RRRR-MM-DD HH24:MI:SSXFF TZR
The error I'm getting is:
Record 1: Rejected - Error on table "DATABASE_NAME"."TABLE", column "CREATED".
ORA-26041: DATETIME/INTERVAL datatype conversion error
If I manually modify the timestamp from 23-APR-12 12.00.00.000000000 AM
to 23-APR-12 12.00.00 AM
it works fine. So my guess is that there's something wrong with the "CREATED" TIMESTAMP "DD-MON-RR HH.MI.SSXFF AM"
.
I noticed as well that there are errors with the same ORA-26041 when months are displayed different. In English October is show as OCT
and in Swedish its OKT
. If I manually change all English versions of the months in the data file, the script works.
created
andchanged
aretimestamp
columns. Can you add your table creation DDL to the question, or at least show what the datatype is for those columns?NLS_DATE_LANGUAGE
toENGLISH
in your environment before runningsqlldr
. I hadn't realised you might not be using an English locale (despite your name; I guess your English and usingApr
threw me!). Can you try that, and I'll try to find that link again...Record 1: Rejected - Error on table "DATABASE"."TABLE", column "CREATED". ORA-26041: DATETIME/INTERVAL datatype conversion error
That's the error I get.