Solved

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

Posted on 2010-08-12
5
4,164 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 500 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

726 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