At the beginning, I encountered a weak problem. I hope you can give me some advice:
The problem is about oracle. I just started to learn oracle and encountered a problem. I read the oracle technical documentation a few days ago about XML DB. As mentioned in this article, to save an xml document to an XMLType table, you must first convert the xml document into an xmltype data. The original text is as follows:
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;
/
Create directory on the server: create directory dir as 'C :\';
Put several xml documents under the Directory and execute: insert into xmltable values (XMLTYPE (getCLOBDocument ('books. xml ')));
The xml document can be inserted into the database. The problem now is: I don't know how to insert the xml document from the client to the oracle database on the server (windows server2003 on the server) what about unix servers.