问题是关于oracle的,刚刚开始学oracle,遇到一个问题,前几天看oracle的技术文档,是关于XML DB的,文中提到,要将xml文档以存到XMLType表中需要先将xml文档转化为xmltype的形式的数据,原文如下:
To store an XML document in an XMLType table or column the XML document must first be converted into an XMLType instance. This is done using the different constructors provided by the XMLType datatype. For example, given a PL/SQL function called getCLOBDocument():
create or replace function getClobDocument(
filename in varchar2,
charset in varchar2 default NULL)
return CLOB deterministic
is
file bfile := bfilename('DIR',filename);
charContent CLOB := ' ';
targetFile bfile;
lang_ctx number := DBMS_LOB.default_lang_ctx;
charset_id number := 0;
src_offset number := 1 ;
dst_offset number := 1 ;
warning number;
begin
if charset is not null then
charset_id := NLS_CHARSET_ID(charset);
end if;
targetFile := file;
DBMS_LOB.fileopen(targetFile, DBMS_LOB.file_readonly);
DBMS_LOB.LOADCLOBFROMFILE(charContent, targetFile,
DBMS_LOB.getLength(targetFile), src_offset, dst_offset,
charset_id, lang_ctx,warning);
DBMS_LOB.fileclose(targetFile);
return charContent;
end;
/
filename in varchar2,
charset in varchar2 default NULL)
return CLOB deterministic
is
file bfile := bfilename('DIR',filename);
charContent CLOB := ' ';
targetFile bfile;
lang_ctx number := DBMS_LOB.default_lang_ctx;
charset_id number := 0;
src_offset number := 1 ;
dst_offset number := 1 ;
warning number;
begin
if charset is not null then
charset_id := NLS_CHARSET_ID(charset);
end if;
targetFile := file;
DBMS_LOB.fileopen(targetFile, DBMS_LOB.file_readonly);
DBMS_LOB.LOADCLOBFROMFILE(charContent, targetFile,
DBMS_LOB.getLength(targetFile), src_offset, dst_offset,
charset_id, lang_ctx,warning);
DBMS_LOB.fileclose(targetFile);
return charContent;
end;
/
在该目录底下放置几个xml文档之后执行:INSERT INTO XMLTABLE VALUES(XMLTYPE(getCLOBDocument('books.xml')));
可以将xml文档插入数据库,现在的问题是:想把客户端的xml文档插入到服务器的oracle数据库中不知道应该怎么做(服务器windows server2003)还有如果是unix的服务器呢。