oracle 如何使用SQL Loader将CSV文件中格式为#,##0.##的列加载到表中?

9lowa7mx  于 2023-06-22  发布在  Oracle
关注(0)|答案(1)|浏览(141)

我正在尝试加载一个包含三列的CSV文件:DEBIT、CREDIT和PREVIOUS_BALANCE_AMOUNT。列的格式为自定义格式:#,##0.##。当我尝试使用SQL Loader作为NUMBER加载列时,我会得到如下错误:
ORA-01722:无效号码
我怎样才能正确地装载色谱柱?
我希望SQL Loader能够使用NUMBER读取数据,但这似乎不起作用。我对这个平台非常陌生,所以很抱歉没有提供更多细节。

xwmevbvl

xwmevbvl1#

样品表:

SQL> create table test (debit number, credit number);

Table created.

控制文件:

load data
infile *
replace
into table test
fields terminated by '|'
trailing nullcols
(
  credit  "to_number(:credit, '9,990.99')",
  debit   "to_number(:debit , '9,990.99')"
)

begindata
1,233.56|8,130.15
3,123.43|7,323.12

加载会话:

SQL> $sqlldr scott/tiger@pdb1 control=test14.ctl log=test14.log

SQL*Loader: Release 21.0.0.0.0 - Production on Tue Jun 13 22:55:04 2023
Version 21.3.0.0.0

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

Path used:      Conventional
Commit point reached - logical record count 1
Commit point reached - logical record count 2

Table TEST:
  2 Rows successfully loaded.

Check the log file:
  test14.log
for more information about the load.

结果:

SQL> select * from test;

     DEBIT     CREDIT
---------- ----------
   8130.15    1233.56
   7323.12    3123.43

SQL>

相关问题