OPTIONS (SKIP=1)
LOAD DATA
INFILE *
APPEND INTO TABLE test_table
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(
CAPITAL FLOAT "replace(:CAPITAL, ',', '')"
)
我尝试使用sql加载器将数据插入表中,我的csv数据是“330,000.00”,我需要的是330000.00,但只有330被插入,为我提供了找到预期输出的解决方案
目标表:
SQL> create table test (capital number);
Table created.
控制文件(底部包含示例数据):
load data
infile *
replace
into table test
fields terminated by whitespace
( capital "to_number(:capital, '999,999,999.99')"
)
begindata
300,000.00
24,435.53
1,374,992.02
加载会话:
SQL> $sqlldr scott/tiger@pdb1 control=test17.ctl log=test17.log
SQL*Loader: Release 21.0.0.0.0 - Production on Mon Apr 1 09:38:48 2024
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 2
Commit point reached - logical record count 3
Table TEST:
3 Rows successfully loaded.
Check the log file:
test17.log
for more information about the load.
SQL>
结果:
SQL> select * from test;
CAPITAL
----------
300000
24435.53
1374992.02
SQL>