我有文本分隔文件,并尝试插入到oracle数据库使用sql loader。我的文件内容是这样的。
根据 mathguy 回复,这是我的文本文件内容
store | datetime | termnmbr | transnmbr | mdesc | mediaamnt | accountnmbr
305 | 12/07/16 10:07 | 1 |6070000449 | CASH | 50000 |
305 | 12/07/16 10:07 | 1 |6070000448 | CASH | 100000 |
305 | 12/07/16 10:07 | 1 |6070000447 | CASH | 50000 |
305 | 12/07/16 10:07 | 1 |6070000445 | CASH | 209000 |
305 | 12/07/16 12:07 | 1 |6070000430 | CASH | 100000 |
305 | 12/07/16 12:07 | 1 |6070000429 | CASH | 50000 |
(6 rows)
我的控制文件
OPTIONS (SILENT=(FEEDBACK),SKIP=1)
LOAD DATA
INFILE *
APPEND
INTO TABLE "MKG_MED_N"
WHEN (1:1) <> '('
FIELDS TERMINATED BY "|"
TRAILING NULLCOLS
(
STORE_CODE,
TRANS_DATE "to_date(:TRANS_DATE, 'DD/MM/YY HH24:MI')",
POS_NO,
TRANS_NO "substr(trim(:TRANS_NO),1,10)",
MED_DESC "trim(:MED_DESC)",
MED_AMOUNT,
MED_ACC_NO "trim(TRANSLATE (:MED_ACC_NO, 'x'||CHR(10)||CHR(13), 'x'))",
)
问题是,我有错误
Record 2: Rejected - Error on table "MKG_MED_N", column TRANS_NO.
ORA-01438: value larger than specified precision allowed for this column.
这来自ArkadiuszŁukasiewicz
所要求的日志文件SQL*Loader: Release 11.2.0.1.0 - Production on Wed Jul 13 14:35:43 2016
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Control File: /u07/mkg/script/MkgMed20160712.305.ctl
Data File: /u07/mkg/1607/MkgMed20160712.305
Bad File: /u07/mkg/bad/MkgMed20160712.305.bad
Discard File: /u07/mkg/discard/MkgMed20160712.305.dis
(Allow all discards)
Number to load: ALL
Number to skip: 1
Errors allowed: 999
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Silent options: FEEDBACK
Table "MKG_MED_N", loaded when 1:1 != 0X28(character '(')
Insert option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
STORE_CODE FIRST * | CHARACTER
TRANS_DATE NEXT * | CHARACTER
SQL string for column : "to_date(:TRANS_DATE, 'DD/MM/YY HH24:MI')"
POS_NO NEXT * | CHARACTER
TRANS_NO NEXT * | CHARACTER
SQL string for column : "substr(trim(:TRANS_NO),1,10)"
MED_DESC NEXT * | CHARACTER
SQL string for column : "trim(:MED_DESC)"
MED_AMOUNT NEXT * | CHARACTER
MED_ACC_NO NEXT * | CHARACTER
SQL string for column : "trim(TRANSLATE (:MED_ACC_NO, 'x'||CHR(10)||CHR(13), 'x'))"
Record 1: Rejected - Error on table "MKG_MED_N", column TRANS_NO.
ORA-01438: value larger than specified precision allowed for this column
Record 2: Rejected - Error on table "MKG_MED_N", column TRANS_NO.
ORA-01438: value larger than specified precision allowed for this column
我的表上的TRANS_NO列定义为Number(11,0)。
正如Finbarr O'B所说,这来自坏文件:
305 | 12/07/16 10:07 | 1 |6070000449 | CASH | 50000 |
305 | 12/07/16 10:07 | 1 |6070000448 | CASH | 100000 |
305 | 12/07/16 10:07 | 1 |6070000447 | CASH | 50000 |
305 | 12/07/16 10:07 | 1 |6070000445 | CASH | 209000 |
305 | 12/07/16 12:07 | 1 |6070000430 | CASH | 100000 |
305 | 12/07/16 12:07 | 1 |6070000429 | CASH | 50000 |
任何人都可以帮助我吗?谢谢。