【问题标题】:Error loading with Oracle sql loader使用 Oracle sql 加载程序加载时出错
【发布时间】:2016-11-25 09:41:18
【问题描述】:

我真的不明白问题出在哪里。我希望你能帮忙。

这是数据文件:

01/04/2013$1.300
01/10/2015$0.100
01/12/2016$0.500

这个文件必须加载到 TableA 中:

  • 2 列:日期(type DATE) 和日期(type NUMBER(5,3))

这里是 ctl 文件:

LOAD DATA
REPLACE
INTO TABLE TABLEA
FIELDS TERMINATED BY '$'
TRAILING NULLCOLS
(THEDATE,
THERATE "to_number(:THERATE, '99999D999', 'NLS_NUMERIC_CHARACTERS=''.,''')")

加载中,我在所有记录的日志中都有这个错误:

Column Name                  Position   Len  Term Encl Datatype

THEDATE                             FIRST     *   $       CHARACTER            
THERATE                             NEXT     *   $       CHARACTER            
SQL string for column : "to_number(:THERATE, '99999D999', 'NLS_NUMERIC_CHARACTERS=''.,''')"

记录 1:被拒绝 - 表 TABLEA 的 THERATE 列出错。 ORA-01438: 该列允许的值大于指定的精度

【问题讨论】:

  • tablea 中“THERATE”列的数据类型是什么?
  • 这是完整的数据文件还是只是摘录?
  • 必须有更多数据。给定数据集加载成功。

标签: oracle sql-loader


【解决方案1】:

相同的代码(只是少量修改但与您的错误无关)对我来说很好。

[oracle@localhost Desktop]$ cat data.txt 
01/04/2013$1.300
01/10/2015$0.100
01/12/2016$0.500

[oracle@localhost Desktop]$ cat control.ctl 
LOAD DATA
INFILE 'data.txt'
REPLACE
INTO TABLE TABLEA
FIELDS TERMINATED BY '$'
TRAILING NULLCOLS
(THEDATE "to_date(:THEDATE, 'MM-DD-YYYY')",
THERATE "to_number(:THERATE, '99999D999', 'NLS_NUMERIC_CHARACTERS=''.,''')")

[oracle@localhost Desktop]$ sqlldr jay/jay control file=control.ctl

SQL*Loader: Release 11.2.0.4.0 - Production on Fri Nov 25 16:04:50 2016

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

Commit point reached - logical record count 4
[oracle@localhost Desktop]$ sqlplus jay/jay

SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 25 16:04:56 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select * from tablea;                   

THEDATE      THERATE
--------- ----------
04-JAN-13        1.3
10-JAN-15         .1
12-JAN-16         .5

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-21
    • 2016-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-22
    相关资源
    最近更新 更多