XMLType insert

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rabbit

    XMLType insert

    Hi all,
    I want to know, how can i insert the xml data using createXML() with
    CLOB in the xmltype column?

    I store the xml data at first in the clob column und want to import
    these data in the xmltype column in another table. But i get always
    the error message:
    java.sql.SQLExc eption:
    ORA-00600: internal error code, arguments: [733], [67107908], [pga
    heap], [], [], [], [], []
    ORA-06512: in "SYS.XMLTYP E", line 0
    ORA-06512: in line 1

    My programm source code:

    CREATE TABLE clobtable(id int PRIMARY KEY not null, xml_dok CLOB)

    CREATE TABLE xmltable(id int CONSTRAINT xml_index PRIMARY KEY not
    null, xml_dok SYS.XMLTYPE)


    PreparedStateme nt pstmt_clob = con.prepareStat ement("INSERT INTO
    clobtable VALUES(?, ?)");
    File fil = new File(path + "xml_ordner " + i);
    String fil_list[] = fil.list();
    int fanzahl = fil_list.length ;
    for (int f = 0; f < fanzahl; f++) {
    f_ordner[f+1] = new File(path + "xml_ordner " + i + "//" +
    fil_list[f]);

    pstmt_clob.setI nt(1, f+1);
    pstmt_clob.setC haracterStream( 2, new
    java.io.FileRea der(f_ordner[f+1]), (int)f_ordner[+1].length());

    pstmt_clob.exec ute();
    }


    PreparedStateme nt pstmt_xml = con.prepareStat ement("INSERT INTO
    xmltable VALUES(?, null)");
    OracleResultSet rs = (OracleResultSe t)stmt.executeQ uery("SELECT * FROM
    clobtable");
    while (rs.next()){
    int nr = rs.getInt(1);
    pstmt_xml.setIn t(1, nr); //id
    pstmt_xml.execu te();

    PreparedStateme nt pstmt = con.prepareStat ement("UPDATE xmltable SET
    xml_dok = SYS.XMLType.cre ateXML(?) WHERE id = ?"); // I have tried to
    use SYS.XMLType(?). But i get the same error.
    pstmt.setClob(1 , rs.getCLOB(2));
    pstmt.setInt(2, nr);
    pstmt.execute() ;
    pstmt.close();
    }

    I don't know, what's wrong with it? Please help!
    Must I use the Connection parameter for cretaeXML und XMLType? Some
    Examples use it, but any not. Which is correct?

    Thank you very much and greeting from germany!


    rabbit
  • Rakesh Patel

    #2
    Re: XMLType insert

    Hi rabbit,

    Go to the above link:


    Raeards,
    Rakesh



    zhoudiwen@hotma il.com (rabbit) wrote in message news:<6a950fe.0 312081432.6182b b82@posting.goo gle.com>...
    Hi all,
    I want to know, how can i insert the xml data using createXML() with
    CLOB in the xmltype column?
    >
    I store the xml data at first in the clob column und want to import
    these data in the xmltype column in another table. But i get always
    the error message:
    java.sql.SQLExc eption:
    ORA-00600: internal error code, arguments: [733], [67107908], [pga
    heap], [], [], [], [], []
    ORA-06512: in "SYS.XMLTYP E", line 0
    ORA-06512: in line 1
    >
    My programm source code:
    >
    CREATE TABLE clobtable(id int PRIMARY KEY not null, xml_dok CLOB)
    >
    CREATE TABLE xmltable(id int CONSTRAINT xml_index PRIMARY KEY not
    null, xml_dok SYS.XMLTYPE)
    ?
    >
    PreparedStateme nt pstmt_clob = con.prepareStat ement("INSERT INTO
    clobtable VALUES(?, ?)");
    File fil = new File(path + "xml_ordner " + i);
    String fil_list[] = fil.list();
    int fanzahl = fil_list.length ;
    for (int f = 0; f < fanzahl; f++) {
    f_ordner[f+1] = new File(path + "xml_ordner " + i + "//" +
    fil_list[f]);
    >
    pstmt_clob.setI nt(1, f+1);
    pstmt_clob.setC haracterStream( 2, new
    java.io.FileRea der(f_ordner[f+1]), (int)f_ordner[+1].length());
    >
    pstmt_clob.exec ute();
    }
    ?
    >
    PreparedStateme nt pstmt_xml = con.prepareStat ement("INSERT INTO
    xmltable VALUES(?, null)");
    OracleResultSet rs = (OracleResultSe t)stmt.executeQ uery("SELECT * FROM
    clobtable");
    while (rs.next()){
    int nr = rs.getInt(1);
    pstmt_xml.setIn t(1, nr); //id
    pstmt_xml.execu te();
    >
    PreparedStateme nt pstmt = con.prepareStat ement("UPDATE xmltable SET
    xml_dok = SYS.XMLType.cre ateXML(?) WHERE id = ?"); // I have tried to
    use SYS.XMLType(?). But i get the same error.
    pstmt.setClob(1 , rs.getCLOB(2));
    pstmt.setInt(2, nr);
    pstmt.execute() ;
    pstmt.close();
    }
    >
    I don't know, what's wrong with it? Please help!
    Must I use the Connection parameter for cretaeXML und XMLType? Some
    Examples use it, but any not. Which is correct?
    >
    Thank you very much and greeting from germany!
    >
    >
    rabbit

    Comment

    Working...