生成具有拒绝原因的sqlldr拒绝文件

时间:2017-01-24 10:46:10

标签: oracle sql-loader

我有一个逗号分隔字段的.csv文件。使用sqlldr此文件数据将上载​​到数据库表中。如果在违反primary keyincorrect number的情况下加载,那么该行将写入.bad文件中,原因将写在.log文件中。

示例:

Input file : 1,2,3,4,5,6 2,3,4,5,6,7 1,2,3,4,5,6

当我因为主键违规而加载上述文件数据时,第3行将写入.bad文件

实施例: Bad file: 1,2,3,4,5,6

日志文件将有

SQL*Loader: Release... Line 3: primary key violated...

我可以将此错误写入.bad文件本身,即在每行末尾写错误信息吗?

示例:

BAD file : 1,2,3,4,5,6, Line3: Primary key violated

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

即使有可能,我也不相信你会这样做。 .bad文件仅包含记录,因此在导致这些记录被拒绝的任何问题得到修复后,可以重命名和重新加载此文件。

来自documentation

The bad file is created in the same record and file format as the 
datafile so that you can reload the data after you correct it. For 
datafiles in stream record format, the record terminator that is found
in the datafile is also used in the bad file.
相关问题