Home » Developer & Programmer » JDeveloper, Java & XML » Reading of names of XML files
icon2.gif  Reading of names of XML files [message #162281] Thu, 09 March 2006 09:35 Go to next message
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 #162821 is a reply to message #162281] Mon, 13 March 2006 14:33 Go to previous messageGo to next message
mchadder
Messages: 224
Registered: May 2005
Location: UK
Senior Member
Hello.

Tom Kyte (asktom.oracle.com) has a discussion about this. Check out http://asktom.oracle.com/pls/ask/f?p=4950:8:3791624498414826948::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:439619916584

Rgds
icon7.gif  Re: Reading of names of XML files [message #162879 is a reply to message #162821] Mon, 13 March 2006 23:50 Go to previous messageGo to next message
jayukanna
Messages: 5
Registered: February 2006
Location: INDIA
Junior Member
thanks mchadder!!
I was looking for a solution in PL/SQL. But I guess there are no solutions available directly.
I will have do it with Java Program.

Thanks for your time.
Jayanthi.
Re: Reading of names of XML files [message #163024 is a reply to message #162879] Tue, 14 March 2006 11:11 Go to previous message
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
Previous Topic: PL/SQL XML extractvalue
Next Topic: load a full directory with documents xml
Goto Forum:
  


Current Time: Thu Apr 25 07:21:09 CDT 2024