To_number, ORA-01722: invalid number error

oracle

I have a batch job which is trying to load data from a .dat file into an Oracle table.

Below is the script within our control file:

LOAD DATA
INTO TABLE TABLE_1
WHEN (1:1)="1"
(
A_id                       POSITION(0002:0005)    CHAR             ,
c_code                     POSITION(0006:0008)    CHAR             ,
status                     POSITION(0009:0009)    CHAR             ,
FTC                        POSITION(0011:0024)    char
                           "to_number(:FTC,'S99,999,999.99')"      ,
TCER                       POSITION(0029:0038)    decimal external ,
ATC                        POSITION(0039:0052)    char
                           "to_number(:ATC,'S99,999,999.99')"      ,
FTR                        POSITION(0053:0066)    char
                           "to_number(:FTR,'S99,999,999.99')"      ,
TRER                       POSITION(0067:0080)    decimal external ,
ATR                        POSITION(0081:0094)    char
                           "to_number(:ATR,'S99,999,999.99')"
)

Records in the file:

1GSXBGBPNR        384.66    0.60801391        632.00       -384.66    0.60801391       -632.00
1GSXBEURNR         10.42    0.70548409         14.00          0.00    0.00000000          0.00
1GSXBEURRE        136.01    0.70533631        192.00          0.00    0.00000000          0.00
1GSXBUSDRE         95.91    0.90472597        106.00        -95.91    0.90472597       -106.00

While the job runs we get the ORA-01722: invalid number error error on the column FTC. How can I fix it?

Best Answer

Your format picture, 'S99,999,999.99', requires that the number begin with a sign -- either "+" or "-" -- which your actual data does not contain.

Remove the S from the format picture.