我有要求将xml文件加载到特定的表。我试着用下面的代码,但它并没有解决我的问题。将xml文件加载到oracle表
XML数据:
7839
FAX SENT
7566
FAX NOT SENT
我是执行与PL/SQL开发网格的帮助程序。右键单击程序Test - >从硬盘加载xml文件 - >执行。
这里是解释过程的DDL。
create table emp3 as select * From emp where 1=1;
alter table emp3 add (fax_response varchar2(50));
create global temporary table tmp_xml of xmltype xmltype store as securefile binary xml;
create or replace procedure proc_upd_email_records (loc_xml in clob) is
begin
insert into tmp_xml
values (xmlparse(document loc_xml)) ;
merge into emp3 e
using (
select id
, response
from tmp_xml t
, xmltable(
'/FAX/EMAILOG'
passing t.object_value
columns id number path 'ID'
, response varchar2(250) path 'RESPONSE'
)
) v
on (e.empno = v.id)
when matched then update
set e.fax_response = v.response;
end;
/
由通过PL/SQL开发人员执行 “测试” 过程方法,我得到以下错误
ora 22805 : can not insert null object into object tables or nested tables
2014-01-24
ravt
+0
您可以分享您正在执行的任务吗?你的代码基本上是正确的。如何调用这个过程是个问题。 –
+0
嗨,我使用Oracle PL SQL开发人员,我传递XML模式参数的文件。简单地从计算机硬盘加载xml文件。我使用的版本是我正在使用的版本是 ** Oracle数据库11g企业版版本11.2.0.1.0 ** –