?
Solved

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

Posted on 2010-08-12
5
Medium Priority
?
4,350 Views
Last Modified: 2013-12-19
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
0
Comment
Question by:MattDuPlessis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 23

Expert Comment

by:David
ID: 33420956
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
 
LVL 8

Expert Comment

by:LindaC
ID: 33428916
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
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 1500 total points
ID: 33428971
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
 

Author Closing Comment

by:MattDuPlessis
ID: 34888623
Resolved
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 34888652
Can I ask what more I could have provided to receive an 'A' grade?
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to recover a database from a user managed backup
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question