How to resolve this ORA-01722: invalid number error in SQL *Loader based concurrent program?

1k Views Asked by At

I am using a sql * loader based concurrent program to upload .csv to Oracle database table.

My table is:

CREATE TABLE Production_Plan
(
  PROCESS     VARCHAR2(4000 BYTE),
  SKU         VARCHAR2(4000 BYTE),
  MACHINE     VARCHAR2(4000 BYTE),
  PRODUCTION  NUMBER
)

And a sample row from .csv table is: enter image description here

After the concurrent program run, it gives warning and log file shows:

Record 1: Rejected - Error on table Production_Plan, column PRODUCTION. ORA-01722: invalid number

But, if I import the same data as an excel file by TOAD it doesn't raise any error

1

There are 1 best solutions below

1
On

Control file; for simplicity, I put sample data in there. Note to_number function applied to the production column.

load data
infile *
replace
into table production_plan
fields terminated by ';'
(process,
 sku,
 machine,
 production "to_number(:production, '999.99')"
)

begindata
sample process;0.12 x 770;sample machine;11.3

Loading session and the result:

SQL> $sqlldr scott/tiger control=test3.ctl log=test3.log

SQL*Loader: Release 11.2.0.2.0 - Production on Sub Svi 1 13:25:57 2021

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Commit point reached - logical record count 1

SQL> select * From production_plan;

PROCESS              SKU                  MACHINE              PRODUCTION
-------------------- -------------------- -------------------- ----------
sample process       0.12 x 770           sample machine             11,3

SQL>