Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> XML File to CLOB and Display it

XML File to CLOB and Display it

From: klabu <klabu76_at_gmail.com>
Date: Wed, 20 Dec 2006 19:45:23 -0500
Message-ID: <12ojm946ujpbm17@corp.supernews.com>


<10gR2>
I want to read a XML file into CLOB and display the (CLOB) content. Keeps erroring at line#14: string buffer too small Can you pls help ?
thanks

DECLARE

    l_xmlclob CLOB := EMPTY_CLOB;
    l_bfile bfile;
    l_buffer VARCHAR2(100);
    l_amount NUMBER := 100 ;
    l_pos NUMBER := 1;

BEGIN
    dbms_lob.createtemporary(l_xmlclob, TRUE);     l_bfile := bfilename( 'DIR_FILES', 'test.xml');
    dbms_lob.fileopen(l_bfile);
    dbms_lob.loadfromfile(l_xmlclob,l_bfile,dbms_lob.getlength(l_bfile));
    dbms_lob.fileclose(l_bfile);
    LOOP
        DBMS_LOB.READ(l_xmlclob, l_amount, l_pos, l_buffer); -- error here
        dbms_output.put_line(l_buffer);
        l_pos := l_pos + l_amount;

    END LOOP;
EXCEPTION
        WHEN NO_DATA_FOUND THEN
                DBMS_OUTPUT.PUT_LINE('End of Chapter Reached.');
END; Received on Wed Dec 20 2006 - 18:45:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US