sqlldr fails with ORA-01858: a non-numeric character was found where a numeric was expected

Hi

I have the following table and data (tab delimited):

CREATE TABLE "TEST"."ACCOUNT_TRANSACTION_HISTORY"
   (      "TRANSACTION_ID" VARCHAR2(20 BYTE),
      "CURRENCY" VARCHAR2(20 BYTE),
      "ACCOUNT_ID" VARCHAR2(20 BYTE),
      "ACCOUNT_NO" VARCHAR2(20 BYTE),
      "ACCOUNT_HOLDER_CLIENT_CODE" VARCHAR2(20 BYTE),
      "ACCOUNT_USER_CLIENT_CODE" VARCHAR2(20 BYTE),
      "TRANSACTION_DATE" DATE,
      "TRANSACTION_TYPE" VARCHAR2(20 BYTE),
      "STATEMENT_DESCRIPTION" VARCHAR2(20 BYTE),
      "FEE_AMOUNT" VARCHAR2(20 BYTE),
      "TRANSACTION_AMOUNT" VARCHAR2(20 BYTE)
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "USERS" ;

Account ID      Account Number      Account Holder Client Code      Account User Client Code      Transaction Date       Business Transaction Id      Business Transaction Code      Statement Description      Currency      Fee Amount      Transaction Amount      Current Balance      Available Balance      Business Transaction Reference
1006      100010      00001      00002      10/06/2010 16:55:32      125      Generation      Generation      BHD      0      -200100      9999799800      9999799800      1026

I have tried loading this data using sqlldr with the following control file:

load data
   infile 'Account_Transaction_History.csv'
   replace
   into table ACCOUNT_TRANSACTION_HISTORY
   fields terminated by X'09'
   TRAILING NULLCOLS
(
 TRANSACTION_ID,
 CURRENCY,
 ACCOUNT_ID,
 ACCOUNT_NO,
 ACCOUNT_HOLDER_CLIENT_CODE,
 ACCOUNT_USER_CLIENT_CODE,
 TRANSACTION_DATE "to_date(:TRANSACTION_DATE, 'DD/MM/YYYY HH24:MI:SS')",
 TRANSACTION_TYPE,
 STATEMENT_DESCRIPTION,
 FEE_AMOUNT,
 TRANSACTION_AMOUNT
)

and get the following error:


SQL*Loader: Release 10.2.0.1.0 - Production on Fri Jun 25 11:26:51 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Control File:   C:\temp\ath.ctl
Data File:      Account_Transaction_History.csv
  Bad File:     C:\temp\Account_Transaction_History.bad
  Discard File:  none specified
 
 (Allow all discards)

Number to load: ALL
Number to skip: 2
Errors allowed: 1000000
Bind array:     64 rows, maximum of 256000 bytes
Continuation:    none specified
Path used:      Conventional
Silent options: FEEDBACK
Table ACCOUNT_TRANSACTION_HISTORY, loaded from every logical record.
Insert option in effect for this table: REPLACE
TRAILING NULLCOLS option in effect

   Column Name                  Position   Len  Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
TRANSACTION_ID                      FIRST     *  WHT      CHARACTER            
CURRENCY                             NEXT     *  WHT      CHARACTER            
ACCOUNT_ID                           NEXT     *  WHT      CHARACTER            
ACCOUNT_NO                           NEXT     *  WHT      CHARACTER            
ACCOUNT_HOLDER_CLIENT_CODE           NEXT     *  WHT      CHARACTER            
ACCOUNT_USER_CLIENT_CODE             NEXT     *  WHT      CHARACTER            
TRANSACTION_DATE                     NEXT     *  WHT      CHARACTER            
    SQL string for column : "to_date(:TRANSACTION_DATE, 'DD/MM/YYYY HH24:MI:SS')"
TRANSACTION_TYPE                     NEXT     *  WHT      CHARACTER            
STATEMENT_DESCRIPTION                NEXT     *  WHT      CHARACTER            
FEE_AMOUNT                           NEXT     *  WHT      CHARACTER            
TRANSACTION_AMOUNT                   NEXT     *  WHT      CHARACTER            

Record 1: Rejected - Error on table ACCOUNT_TRANSACTION_HISTORY, column TRANSACTION_DATE.
ORA-01858: a non-numeric character was found where a numeric was expected

If I play around with the settings I sometimes get a different response but can't get the data to actually load.

Any help would be appreciated.

Matt
MattDuPlessisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DavidSenior Oracle Database AdministratorCommented:
A quick pass and I should have looked this up, but my eyes caught on the colon used to begin the column ("to_date(:TRANSACTION)  -- that's where I'd expect the syntax error to arise.  I'll try to check this out further later today.
0
LindaCCommented:
Hi.

This is the modified ctl, please see the TRANSACTION_DATE line, a NULLIF TRANSACTION_DATE=BLANKS

load data
   infile 'Account_Transaction_History.csv'
   replace
   into table ACCOUNT_TRANSACTION_HISTORY
   fields terminated by X'09'
   TRAILING NULLCOLS
(
 TRANSACTION_ID,
 CURRENCY,
 ACCOUNT_ID,
 ACCOUNT_NO,
 ACCOUNT_HOLDER_CLIENT_CODE,
 ACCOUNT_USER_CLIENT_CODE,
 TRANSACTION_DATE "to_date(:TRANSACTION_DATE, 'DD/MM/YYYY HH24:MI:SS')" NULLIF TRANSACTION_DATE=BLANKS,
 TRANSACTION_TYPE,
 STATEMENT_DESCRIPTION,
 FEE_AMOUNT,
 TRANSACTION_AMOUNT
)
0
slightwv (䄆 Netminder) Commented:
First: you have 11 columns in the control file and 14 columns in your data.

Second:  TRANSACTION_DATE is the 7th column in your control file and the 5th in the data provided.

Third:  Do the column heading exist in the CSV file?  If so you need to SKIP 1.

Given the table definition above, I trimmed down the example you gave and tested this using 10.2.0.3.  Make sure the file is tab separated and Experts-Exchange doesn't remove the tabs.

options (skip=1)
load data
   infile *
   replace
   into table ACCOUNT_TRANSACTION_HISTORY
   fields terminated by X'09'
   TRAILING NULLCOLS
(
 ACCOUNT_ID,
 ACCOUNT_NO,
 ACCOUNT_HOLDER_CLIENT_CODE,
 ACCOUNT_USER_CLIENT_CODE,
 TRANSACTION_DATE "to_date(:TRANSACTION_DATE, 'DD/MM/YYYY HH24:MI:SS')"
)
BEGINDATA
Account	Number	Client	Code	Transaction Date
1007	100010	00001	00002	10/06/2010 16:55:32

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MattDuPlessisAuthor Commented:
Resolved
0
slightwv (䄆 Netminder) Commented:
Can I ask what more I could have provided to receive an 'A' grade?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.