Reading of names of XML files [message #162281] |
Thu, 09 March 2006 09:35 |
jayukanna
Messages: 5 Registered: February 2006 Location: INDIA
|
Junior Member |
|
|
Hi,
Can someone help me?
I need to pass xml file name as input to a procedure.
I want to know the names of all the files in a folder and want to insert it into a table.
Is this possible in PL/SQL. I searched in the net and found only Java code.
To explain it better with an example,
lets say I have 500 xml files in a folder. I need the names of all these xml files and insert the name alone into a table.
Can this be done with out using C or Java Code?
Thanks in advance for your help.
Jayanthi
|
|
|
|
|
Re: Reading of names of XML files [message #163024 is a reply to message #162879] |
Tue, 14 March 2006 11:11 |
askshirsagar
Messages: 9 Registered: February 2006 Location: India
|
Junior Member |
|
|
Are you looking for following code. For more information visit on following link.
http://www.oracle-base.com/articles/9i/LoadXMLTYPEFromFile.php
CREATE OR REPLACE PROCEDURE load_xml (p_dir IN VARCHAR2,
p_filename IN VARCHAR2) AS
l_bfile BFILE := BFILENAME(p_dir, p_filename);
l_clob CLOB;
BEGIN
DBMS_LOB.createtemporary (l_clob, TRUE);
DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);
DBMS_LOB.loadfromfile(l_clob, l_bfile, DBMS_LOB.getlength(l_bfile));
DBMS_LOB.fileclose(l_bfile);
INSERT INTO xml_tab (
id,
filename,
xml
)
VALUES (
xml_tab_seq.NEXTVAL,
p_filename,
XMLTYPE.createXML(l_clob)
);
COMMIT;
DBMS_LOB.freetemporary (l_clob);
END;
/
Rgds,
Avinash
|
|
|