尝试将数据从具有blob列的表插入具有二进制xml列的表
源表
desc "T24"."FBNK_ACCOUNT_CLOSED";
Name Null? Type
----------------------------------------- -------- ----------------------
------
RECID NOT NULL VARCHAR2(255)
XMLRECORD BLOB
目标表
SQL> desc "T24"."FBNK_ACCOUNT_CLOSED_TEMP";
Name Null? Type
----------------------------------------- -------- ----------------------
------
RECID NOT NULL VARCHAR2(255)
XMLRECORD XMLTYPE STORAGE BINARY
所以我正尝试如下插入数据,但失败
SQL> insert into "T24"."FBNK_ACCOUNT_CLOSED_TEMP" select RECID,XMLRECORD
from "T24"."FBNK_ACCOUNT_CLOSED" where rownum<10;
insert into "T24"."FBNK_ACCOUNT_CLOSED_TEMP" select RECID,XMLRECORD from
"T24"."FBNK_ACCOUNT_CLOSED" where rownum<10
*
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected - got BLOB
我要关注的文档是oracle文档(文档ID 1405457.1)
下面是oracle文档中的几行
” 使用insert select作为语法将数据从scott.tb blob移到以二进制XML存储的scott.po_bin XMLType表中
SQL> insert into po_bin select xmltype(bc, 873) from scott.tb;
1 row created.
SQL> select * from po_bin;
SYS_NC_ROWINFO$
----------------------------------------------------------------------------
----
<?xml version="1.0" encoding="US-ASCII"?>
<PurchaseOrder>
<Reference>ADAMS-20011127121040988PST</Reference>
<Actions>
<Action>
<User>SCOTT</User>
<Date>2002-03-31</Date>
</Action>
</Actions>
<Reject/>
...
...
”
尝试编辑代码,但很少修改,但仍然失败,并显示其他错误号
insert into "T24"."FBNK_ACCOUNT_CLOSED_TEMP" select recid,
xmltype(xmlrecord, 873) from "T24"."FBNK_ACCOUNT_CLOSED" where rownum<1000
*
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00210: expected '<' instead of '2'
Error at line 1
ORA-06512: at "SYS.XMLTYPE", line 283
ORA-06512: at line 1
答案 0 :(得分:0)
此失败的原因是该表包含一些无效的XML数据。 因此,将数据插入XML二进制列时,某些行的验证失败。 所以这不能在这张桌子上做。 但是根据oracle文档,我的步骤是正确的。