如何使用 SQL*Loader 截断数据以适合字段? (ORA-12899)
使用 Oracle SQL*Loader,我尝试将另一个数据库中的可变长度字符串 (lob) 列加载到 Oracle 中的 varchar2(4000) 列中。我们的字符串远远超过 4000 个字符,但每个人都同意这些字符串可以而且应该在迁移中被截断(我们已经查看了超过 4000 个字符的数据,它没有意义)。为此,我在控制文件中以这种方式指定了列:
COMMENTS CHAR(65535) "SUBSTR(:COMMENTS, 1, 4000)",
但是,SQL*Loader 仍然拒绝数据文件中该记录长度超过 4000 个字符的任何行:
记录 6484:已拒绝 - 表 LOG_COMMENT、列 COMMENTS 出错。 ORA-12899: COMMENTS 列的值太大(实际:11477,最大值:4000)
记录 31994:已拒绝 - 表 LOG_COMMENT、列 COMMENTS 出错。 ORA-12899: COMMENTS 列的值太大(实际:16212,最大值:4000)
记录 44063:已拒绝 - 表 LOG_COMMENT、列 COMMENTS 出错。 ORA-12899: COMMENTS 列的值太大(实际:62433,最大值:4000)
我尝试采用更小的子字符串,但仍然遇到相同的错误。如何更改控制文件以将长度超过 4000 个字符的字符串数据截断到 varchar2(4000) 列中?
Using Oracle SQL*Loader, I am trying to load a column that was a variable length string (lob) in another database into a varchar2(4000) column in Oracle. We have strings much longer than 4000 characters, but everyone has agreed that these strings can and should be truncated in the migration (we've looked at the data that goes beyond 4000 characters, it's not meaningful). To do so, I specified the column this way in the control file:
COMMENTS CHAR(65535) "SUBSTR(:COMMENTS, 1, 4000)",
However, SQL*Loader still rejects any row where this record is longer than 4000 characters in the data file:
Record 6484: Rejected - Error on table LOG_COMMENT, column COMMENTS.
ORA-12899: value too large for column COMMENTS (actual: 11477, maximum: 4000)Record 31994: Rejected - Error on table LOG_COMMENT, column COMMENTS.
ORA-12899: value too large for column COMMENTS (actual: 16212, maximum: 4000)Record 44063: Rejected - Error on table LOG_COMMENT, column COMMENTS.
ORA-12899: value too large for column COMMENTS (actual: 62433, maximum: 4000)
I tried taking a much smaller substring and still got the same error. How can I change my control file to truncate string data longer than 4000 characters into a varchar2(4000) column?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查以确保您的数据 ENCODING 和 Oracle ENCODING 不冲突。
在这种情况下,加载时使用 CHARACTERSET 选项。
Check to make sure your data ENCODING and Oracle ENCODING are not conflict.
In this case, use CHARACTERSET option when loading.
无论如何,
这是正确的语法。
使用 sqlldr 11.2.0.1 它对我来说可以成功工作,直到输入记录列 > 4000,
如果我切换到直接路径负载,我会得到 a,然后我会像你一样得到 smae 错误。
最后我把它分成了 2 阶段加载..我现在有一个临时表,其中有一列 CLOB 类型的列,我加载该表,
然后将其插入到 eth 主表中,希望
这会有所帮助
by all accounts
is the correct syntax.
using sqlldr 11.2.0.1 it works successfully for me up until the point where the input record column is > 4000 where i get a
if i switch to a directpath load then i get the smae error as you.
in the end i have split it into a 2 stage load.. i now have a staging table with a column of type CLOB which i load with
which then gets inserted to eth main table with a
hope thats helpful