从 blob 插入二进制 xml

inserting into binary xml from blob

尝试将数据从具有 blob 列的 table 插入到具有二进制 xml 列的 table 列

来源table

desc "T24"."FBNK_ACCOUNT_CLOSED"; 
Name Null? Type 
----------------------------------------- -------- ---------------------- 
------ 
RECID NOT NULL VARCHAR2(255) 
XMLRECORD BLOB 

目标table

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)

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=309572821111227&parent=SrDetailText&sourceId=3-19827644581&id=1405457.1&_afrWindowMode=0&_adf.ctrl-state=1qwexs4zw_510

以下是 oracle 文档中的几行

” 使用 insert select 作为语法将数据从 scott.tb blob 移动到 scott.po_bin XMLType table 存储为二进制 XML

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 

此失败的原因是 table 包含一些无效的 XML 数据。 因此,在将数据插入 XML 二进制列时,某些行的验证失败。 所以这不能在 table 上完成。 但根据 oracle 文档,我的步骤是正确的。