CLOB problem

I'm having the following problem processing a CLOB:
num := dbms_lob.getLength(result);
Num gives me a null value, is from type NUMBER
the following prints the content of the clob
xmlstr := dbms_lob.SUBSTR(result,32767);
loop
exit when xmlstr is null;
line := substr(xmlstr,1,instr(xmlstr,chr(10))-1);
dbms_output.put_line('| '||line);
xmlstr := substr(xmlstr,instr(xmlstr,chr(10))+1);
end loop;
What may be the explaination of this? I'm using Oracle 9i
Thank you for attention
Best Regards
João Lopes

Ok thank you for your posts, i'm starting to think that it is a bug... follows my code:
procedure testeXML(idSP in NUMBER)
is
parserXML xmlparser.parser;
dadosAvaria dbms_xmlgen.ctxHandle;
result CLOB;
v_numCons varchar2(10);
xmlstr varchar2(32767);
CURSOR C_numConsorcio is
SELECT num_cons FROM r_identi where num_cons = IdSP;
CURSOR C_equipas is
select ID_equipa from r_eqitec where
substr(to_char(id_tecnico), 0, length(to_char(v_numcons))) = to_char(v_numcons);
v_outra C_numconsorcio%rowtype;
i number :=0;
line varchar2(2000);
doc xmldom.domdocument;
nl xmldom.DOMNodeList;
numeroOcorrencias number;
begin
open C_numConsorcio;
FETCH C_numConsorcio INTO v_outra;
v_numCons := v_outra.num_cons;
close C_numConsorcio;
FOR equipa IN C_equipas LOOP
dadosAvaria := dbms_xmlgen.newContext('SELECT
Id_Avaria,
num_posto,
ps,
CCO_1,
CCO_2,
Operacao,
Sub_Operacao,
sub_esp from r_avari1 where id_equipa = ' || equipa.Id_equipa);
DBMS_XMLGen.setRowTag(dadosAvaria, 'R_Acti_API_SP');
DBMS_XMLGen.SETROWSETTAG(dadosAvaria, 'ListagemAvarias');
result := DBMS_XMLgen.getXML(dadosAvaria);
insert into R_BD_SS_XML_SP(MENSAGEMXML, IDSP, DATAHORA) values (result,v_outra.num_cons,sysdate);
parserXML := xmlparser.newparser;
numeroOcorrencias := -1;
xmlstr := dbms_lob.SUBSTR(result,32767);
end loop;
if result is not null then
xmlparser.parseclob(parserXML, result);
doc := xmlparser.getdocument(parserXML);
xmlparser.freeparser(parserXML);
nl := xmldom.getElementsByTagName(doc, 'ListagemAvarias');
numeroOcorrencias := xmldom.getLength(nl);
end if;
numeroOcorrencias := dbms_lob.getLength(result);
dbms_output.put_line('Existe um total de '||numeroOcorrencias|| ' actividades.');
end testeXML;
This is my code, as in your answer i tried to put my CLOB in a table and then read it from there, but the insert statement tell me that RESULT as a null value, but then it can print the content of result if i make dbms_lob.SUBSTR(result,32767).
This is a very strange situation, do you think that the SUBSTR handles de variable in some way that it can fetch it's content?
Best Regards
João Lopes

Similar Messages

  • Convert String to CLOB problem, CLOB is a input parameter in the procedure.

    I can not flush and close "Writer"??
    The following code:
    CLOB inclob=null;
    CallableStatement csr=conn.prepareCall ("begin TestClob(?); end;");
    csr.registerOutParameter (1, Types.CLOB);
    inclob = CLOB.createTemporary(conn,false,CLOB.DURATION_CALL);
    inclob .open(CLOB.MODE_READWRITE);
    Writer tempClobWriter = inclob.getCharacterOutputStream();
    tempClobWriter.write("This is In CLOB");
    // Flush and close the stream
    tempClobWriter.flush(); // problem is here
    tempClobWriter.close();//problem is here
    inclob.close();// this works
    Btw:
    How to use CLOB.setString() to specify string to CLOB directly?
    Message was edited by:
    user515324

    sorry, I fogot mention the error is "No data to read from socket"
    My Oracle JDBC driver is 9.2.0.4, Oracle database is 10.2.1.0
    Some guy said it is driver's problem.

  • CLOB problem in 9.0.4

    hi all,
    I recently converted two LONG columns to a CLOBs. there is no default value on either of these columns.
    The forms properties for the CLOBs are data type: LONG, max length : 32000, data length semantics: NULL
    During testing, I found that any data entered in the form field, would not be saved to the DB, even though all indications were a good save/commit. the data seemed to disappear.
    a direct update statment via sql*plus updates the CLOB without any problems.
    Luckily, i received in oracle insert error. the HELP menu, display errors showed me why the data was disappearing. forms was sending an EMPTY_LOB no matter what is typed into the field. please see below. the save is working, however forms insert is not using the data from the form, it is submitting EMPTY_CLOB()!!
    i have searched everywhere to find the EMPTY_CLOB() statment. it does not exist in the form or attached libraries ( or on the database fo that matter).
    does anyone have any ideas for me, on finding it, or preventing it.
    INSERT INTO bg_bug(LOGGED_BY,BUG_SEQ_NUM,BUG_DESCRIP,STATUS_CODE,STATUS_CHANGE_DATE,PROJ_CODE,MODULE_NAME,SEVERITY_CODE,ASSIGNED_TO,LOGGED_DATE,tech_liaison,REQUESTOR,DUE_DATE,LOCK_BUG,LOCKED_BY,PRIVATE_BUG,PRIVATE_BY,MOO,moo_history,developer_comment) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,:17,:18,EMPTY_CLOB(),EMPTY_CLOB()) RETURNING ROWID,LOGGED_BY,BUG_SEQ_NUM,BUG_DESCRIP,STATUS_CODE,STATUS_CHANGE_DATE,PROJ_CODE,MODULE_NAME,SEVERITY_CODE,ASSIGNED_TO,LOGGED_DATE,tech_liaison,REQUESTOR,DUE_DATE,LOCK_BUG,LOCKED_BY,PRIVATE_BUG,PRIVATE_BY,MOO,moo_history,developer_comment INTO :21,:22,:23,:24,:25,:26,:27,:28,:29,:30,:31,:32,:33,:34,:35,:36,:37,:38,:39,:40,:41

    I have a problem when passing a CLOB value from FORMS to a backend procedure.
    I have coded a back-end proc to accept CLOB data and update a table. In the Forms, I have code in the POST-INSERT (since I have made CLOB column as non-database item) trigger to get the CLOB item of the block and invoke the backend procedure passing the clob as a parameter.
    On testing, I found that the data updated in the table by the proc is[b] JUNK.
    To narrow the problem, I have used dbms_lob.read in back-end proc to read the clob value in to another varchar variable and this varchar variable contains the correct data. So, the data passed from the front-end to back-end seems to be okay. But, instead of varchar, if I copy data into another CLOB variable using dbms_lob.copy in back-end proc, and display this variable, I find junk value. Similarly, the clob data getting into the clob field of the table is junk.
    So, there seems to be some charset(??) conversion problem between client CLOB and Server CLOB. Not sure how to resolve this.
    Could someone please advise?
    Code Snipplet
    POST-INSERT on forms
    ==================
    declare
    vCmttext CLOB;
    msgendtag VARCHAR2(100) CHARACTER SET vCmttext%CHARSET:= '</ichicsr>';
    begin
    dbms_lob.createtemporary (vCmttext,TRUE,10);
    dbms_lob.open (vCmttext,1);
    dbms_lob.write(vCmttext,length (msgendtag),1, msgendtag);
    AS_TEST_LOG_UPD(id,seq_nbr,vCmttext);
    end;
    BackEnd Proc
    ==========
    CREATE OR REPLACE PROCEDURE AS_TEST_LOG_UPD(vid varchar2, vSEQ_NBR number,
    vCommenttext TEST_LOG.CMNT%type)
    AS
    l_text_buffer varchar2(100);
    l_text_amount BINARY_INTEGER := 100;
    vComment1 clob CHARACTER SET vCommenttext%CHARSET;
    amt INTEGER := 3000;
    BEGIN
    dbms_lob.read(vCommenttext, l_text_amount, 1, l_text_buffer );
    DebugProcFunc('clob.txt',l_text_buffer); --- This Prints the correct data
    dbms_lob.createtemporary (vComment1,TRUE,10);
    dbms_lob.open (vComment1,1);
    dbms_lob.copy (vComment1,vCommenttext, amt, 1, 1); -- Copy the Client CLOB to server CLOB
    dbms_lob.read(vComment1, l_text_amount, 1, l_text_buffer ); --- This Prints the JUNK data
    DebugProcFunc('clob.txt',l_text_buffer);
    Update TEST_LOG Set
    CMNT = vComment1 -- Updating the Junk data
    Where ID = vid and SEQ_NBR = vSEQ_NBR;
    END;
    Thank you,
    Beena

  • Callable statement Clob problem..reading and writing

    Hi,
    I am having problem ,,trying to read and write a clob object ...
    DB Server is oracle 9i and app server is WAS5.1
    I am geting exception...
    java.sql.SQLException: Missing IN or OUT parameter at index::
    pls check the code below..
    Connection connection = null;
    CallableStatement csmtObj = null;
    Clob clob = null;
    try {
    connection = getConnection();
    csmtObj = connection.prepareCall("{call MYPROC(?,?,?)}");
    csmtObj.registerOutParameter(1,Types.CLOB);
    csmtObj.setString(2,"xxx");
    csmtObj.setString(3,"YYY");
    csmtObj.execute();
    clob = csmtObj.getClob(1);
    } catch (Exception exception){
    exception.printStackTrace();
    throw exception;
    Regards

    Thanks
    I was able to resolve the reading part but ...I am getting exception while writing ..
    it says parameter type conflict..
    This is the code
    public static boolean putStringAsCLOB(String strContent, String strDataType,
              String strOperType) {
         boolean operationStatus=false;
         Connection connection = null;
         CallableStatement csmtObj = null;
    String clob = strContent;
    ByteArrayInputStream bais = new ByteArrayInputStream(pfoAsBytes);
    InputStreamReader reader=new InputStreamReader(bais);     
    try {
              connection = getConnection();
              csmtObj = connection.prepareCall("{call MYPROC(?,?,?)}");     
              csmtObj.setCharacterStream(1,reader,pfoAsBytes.length);
         csmtObj.setString(2,strDataType);
              csmtObj.setString(3,strOperType);
              operationStatus=csmtObj.execute();
         } catch (Exception exception){
              exception.printStackTrace();          
         } finally{
              if(connection != null){
                   try {
                        connection.close();
                   } catch (SQLException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
         return operationStatus;
    Regards
    Message was edited by:
    user606712

  • Import of Tables with CLOB problem.

    Hi,
    I am having problems with the import of tables with CLOB columns.
    Tables with CLOB columns will force the use of the tablespace in which it (table) was created originally. It will not be created on the new schema's default tablespace. Is there a way to get around this problem?
    More on this problem can be found here :
    Re: Import error 1647, CLOB fields problem, need help!
    I am using Oracle 9.2.0.6 standard edition, that is why the transportable tablespace option will not work.
    Thanx
    Rob

    Sorry I have posted the wrong link, it should be:
    Re: Import error 1647, CLOB fields problem, need help!
    Regards
    Rob

  • CLOB problem (disregard my former message relating to Forms 6i)

    Hallo,
    I have a problem using CLOB's with JDeveloper 3.1. We have an Oracle DB (8.1.5 on a Unix server) where one of the tables has a CLOB column. We also created a view where we join several fields from three tables. One of the fields is the CLOB field. Now using JDeveloper 3.1 with BC4J we designed a simple user interface that accesses this view. So far everything works fine but if we edit the CLOB field of the record and and want to save the modification we either get Error Message JBO-25014: Another user has changed the row with primary key oracle.jbo.Key (although it is sure that no other user changed this record). The other Error Message that we get is JBO-25009: Unable to create object ... with value (and then it just prints the whole content of the CLOB field).
    Any ideas what is wrong? We have a bit a problem with the CLOB's because we also cannot produce a working GUI with Forms 6i, alltough Forms has another kind of problem with CLOB's. I slowly start to wonder if the CLOB's have been introduced with the intent that nobody should use them .... :)
    Cheers, Berny

    I've got the same problem, and if you press the save button two or three times it will work. (the first time it always gives error)
    IF this is your problem (it was what happened with my programs, but I use 8iR2) you could done something like (*arrg*) this:
    while (true) {
    row.setAttribute("MyClobAtribute",MyClobVal);
    It's suprising that is working for me.
    Good Luck
    null

  • How to slove this Clob problem

    Hi all,
    First I defined a table in oracle8i using the following code:
    create xmltab(id number primary key,xml_content clob);
    then in jdev9i ,I wrote the following code:
    try{
    Connection con=getConnection();
    PreparedStatement pstmt =
    con.prepareStatement ("insert into xmltab (id, xml_content) values (id_seq.NEXTVAL, ?)");
    //a very large String is stored in tempBuffer
    pstmt.setCharacterStream(1,new StringReader(tempBuffer.toString()),tempBuffer.toString().length());
    pstmt.execute();
    con.commit();
    pstmt.close();
    con.close();
    tempBuffer.delete(0,tempBuffer.toString().length());
    JOptionPane.showInternalMessageDialog(this.getContentPane(),"l,w",""
    ,JOptionPane.INFORMATION_MESSAGE);
    }catch(Exception e1){
    e1.printStackTrace();
    I found that the String in StringBuffer is truncated when it is commited to database.But if change the xmltab definition as:
    xmltab(id number primary key,xml_content varchar2(4000));
    the result is right,but i hope that the String length is larger than 4000 when is insert into xmltab,How can i solve this problem?
    How can i use setClob(index,Clob) when meeting the String type??

    hi langyun,
    This is an extract from Oracle9i JDBC developers guide.,
    The JDBC 2.0 specification states that PreparedStatement methods setBinaryStream() and setObject() can be used to
    input a stream value as a BLOB, and that the PreparedStatement methods setAsciiStream(), setUnicodeStream(),
    setCharacterStream(), and setObject() can be used to input a stream value as a CLOB. This bypasses the LOB locator,
    going directly to the LOB data itself.
    In the implementation of the Oracle JDBC drivers, this functionality is supported only for a configuration using an 8.1.6 and higher
    database and 8.1.6 and higher JDBC OCI driver. Do not use this functionality for any other configuration, as data
    corruption may result.
    To know how to use LOB datatypes , refer to any of the following samples.,
    LOB Features
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/jdbc20/jdbc20.htm
    New LOB APIs and DateTime Support Sample
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/9i_jdbc/content.html
    hope this helps
    Regards
    Elango.

  • Need details of CLOB problems solved by new drivers

    Hi all. I found a Tech Note on the Adobe site about updated
    drivers:
    http://kb.adobe.com/selfservice/viewContent.do?externalId=42dcb10a&sliceId=2
    In the Notes section (near the end), it states, "Oracle users
    should use the latest 3.5 drivers for Oracle 10g R2 support and
    because all known issues with clobs are resolved in this set of
    drivers."
    Does anyone know where I can find documentation on exactly
    what the "all known issues with clobs" that were solved are?
    Thanks.

    *@ Prasanna*
    I understood this part:
    {color:#ff0000} its Possible.
    All you have to do is, just set the same RootApplication module for 2 pages.
    and use retainAM=Y when navigating between the pages.
    this should be enough...
    And when navigating to second page, don't call vo.executeQuery() or anything that flushes the pending changes in the VO{color}
    Now for this part:
    {color:#ff0000}
    while navigating to second page, just find the second row you want to update using vo1.findByprimarykey()
    and use vo.setCurrentRow(firstChildRow) method at first Child's VO to refresh the rows of the second Child
    {color}
    I will put it this way,
    h2. Page1
    h4. Invoice Header
    Master Field 1 MasterField 2
    Master Field 3 MasterField 4
    h3. Advanced Table for Child Record (Invoice Lines)
    Row1 Field1_1 Field1_2 image1_3
    Row2 Field2_1 Field2_2 image2_3
    Row3 Field3_1 Field3_2 image3_3
    Row4 Field4_1 Field4_2 image4_3
    On Clicking the image in any of the rows, we will be taken
    to the Page2 where we will have to
    enter Child Records for each of the Child Row selected in Page1.
    h3. Page2
    h4. Advanced Table for Child Records (Distribution
    h4. Lines) for each Child Record(Invoice Line) in Page1
    Row1 Field1_1 Field1_2 Field1_3
    Row2 Field2_1 Field2_2 Field2_3
    Button to go back to Page1
    Let me assume that the Child VO for the Page1 is VO1 and that of Page2 is VO2
    Now According to what you have adviced, i interpreted that, suppose Clicking on the Image2_3 of Row2 of Page1, I would go to the Page2 and there in the PR of the form, i would find the Row selected using OARow Row2=VO1.findByprimarykey()
    and then set it as the Current Row using VO1.setCurrentRow(Row2)
    where Row2 is the Row that we had selected in Page1. So doing this would automatically refresh the Child Rows in Page2 for Row2 selected in Page1. And then i can go back to Page1 and continue the same for the other rows.
    Sorry for making this too long. Needed to make sure that I was clear in asking my Question. :8}

  • ORACLE CLOB problem

    Hi,
    When inserting CLOB of size > 4000 (Oracle database) I encountered an oracle
    error: ORA-01002: fetch out of sequence while inserting.
    If CLOB < 4000 it works fine.
    Kodo version 3.0.1
    I'll appreciate any help, thanks in advance
    Test source:
    TestClob testClob = new TestClob();
    testClob .setAttributeValue("name", "name1");
    StringBuffer data = new StringBuffer();
    for (int i = 1; i < 4010; i++) {
    data.append("X");
    testClob .setAttributeValue("dataClob", data);
    PersistenceManager pm1 = getPersistenceManager();
    pm1.currentTransaction().begin();
    pm1.makePersistent(testClob );
    pm1.currentTransaction().commit();
    jdo file:
    <class name="TestClob">
    <extension vendor-name="kodo" key="jdbc-class-ind-value" value="1"/>
    <extension vendor-name="kodo" key="table" value="TEST_CLOB"/>
    <extension vendor-name="kodo" key="pk-column" value="ID"/>
    <extension vendor-name="kodo" key="detachable" value="true"/>
    <extension vendor-name="kodo" key="jdbc-sequence-name"
    value="SEQ_TEST_CLOB"/>
    <field name="name" default-fetch-group="false" >
    <extension vendor-name="kodo" key="fetch-group" value="TestClob_name"/>
    <extension vendor-name="kodo" key="data-column" value="NAME"/>
    </field>
    <field name="dataClob" default-fetch-group="false"
    persistence-modifier="persistent">
    <extension vendor-name="kodo" key="fetch-group" value="TestClob_dataClob"/>
    <extension vendor-name="kodo" key="data-column" value="CLOB_DATA"/>
    <extension vendor-name="kodo" key="jdbc-size" value="-1"/>
    </field>
    </class>
    Oracle DB table:
    CREATE TABLE test_clob (
    ID NUMBER ( 10 ) NOT NULL,
    NAME VARCHAR2 ( 255 ) NOT NULL,
    clob_data clob,
    LAST_UPDATE NUMBER(18),
    PRIMARY KEY (ID)
    mapping file:
    <class name="TestClob">
    <jdbc-class-map type="base" table="TEST_CLOB" pk-column="ID" />
    <field name="name">
    <jdbc-field-map type="value" column="NAME"/>
    </field>
    <field name="dataClob">
    <jdbc-field-map type="clob" column="CLOB_DATA"/>
    </field>
    </class>
    Error log:
    - <t -1133534024, conn 5> [10 ms] executing prepstmnt 14 INSERT INTO
    OSS_INV.TES
    T_CLOB (CLOB_DATA, ID, LAST_UPDATE, NAME) VALUES (?, ?, ?, ?) [params=(Clob)
    ora
    cle.sql.CLOB@5f4e2d, (long) 1215, (long) 12, (String) nazwa]
    - <t -1133534024, conn 5> [20 ms] executing prepstmnt 15 SELECT t0.CLOB_DATA
    FRO
    M OSS_INV.TEST_CLOB t0 WHERE t0.ID = ? FOR UPDATE [params=(long) 1215]
    - An exception occurred while ending the transaction. This exception will
    be re
    -thrown.
    kodo.util.FatalDataStoreException: ORA-01002: fetch out of sequence
    {prepstmnt 15 SELECT t0.CLOB_DATA FROM OSS_INV.TEST_CLOB t0 WHERE t0.ID = ?
    FOR
    UPDATE [params=(long) 1215]} [code=1002, state=72000]
    NestedThrowables:
    com.solarmetric.jdbc.ReportingSQLException: ORA-01002: fetch out of sequence
    {prepstmnt 15 SELECT t0.CLOB_DATA FROM OSS_INV.TEST_CLOB t0 WHERE t0.ID = ?
    FOR
    UPDATE [params=(long) 1215]} [code=1002, state=72000]
    java.sql.SQLException: ORA-01002: fetch out of sequence
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:42)
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:24)
    at
    kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:510)
    at
    kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java
    :158)
    at
    kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerI
    mpl.java:788)
    at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManag
    erImpl.java:644)
    at
    weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
    erSCInfo.java:1010)
    at
    weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
    rverSCInfo.java:115)
    at
    weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
    dChain(ServerTransactionImpl.java:1142)
    at
    weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
    ServerTransactionImpl.java:1868)
    at
    weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
    rverTransactionImpl.java:250)
    at
    weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
    sactionImpl.java:221)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.jav
    a:416)

    Pawe-
    Can you post the complete stack trace? I think you may have truncated
    one or more of the nested exceptions, which are important.
    The exception is odd: I believe it indicates that the row into which we
    will be updating the CLOB wasn't found. This is strange because the
    initial insert seems to have succeed on the line previous.
    Can you try this with Kodo 3.0.3? Also, which version of Oracle and the
    JDBC driver are you using? We recommend using version 9.0.2 of the
    driver, since that is the most stable in our experience.
    In article <[email protected]>, Pawe__ |wierszcz wrote:
    Hi,
    When inserting CLOB of size > 4000 (Oracle database) I encountered an oracle
    error: ORA-01002: fetch out of sequence while inserting.
    If CLOB < 4000 it works fine.
    Kodo version 3.0.1
    I'll appreciate any help, thanks in advance
    Test source:
    TestClob testClob = new TestClob();
    testClob .setAttributeValue("name", "name1");
    StringBuffer data = new StringBuffer();
    for (int i = 1; i < 4010; i++) {
    data.append("X");
    testClob .setAttributeValue("dataClob", data);
    PersistenceManager pm1 = getPersistenceManager();
    pm1.currentTransaction().begin();
    pm1.makePersistent(testClob );
    pm1.currentTransaction().commit();
    jdo file:
    <class name="TestClob">
    <extension vendor-name="kodo" key="jdbc-class-ind-value" value="1"/>
    <extension vendor-name="kodo" key="table" value="TEST_CLOB"/>
    <extension vendor-name="kodo" key="pk-column" value="ID"/>
    <extension vendor-name="kodo" key="detachable" value="true"/>
    <extension vendor-name="kodo" key="jdbc-sequence-name"
    value="SEQ_TEST_CLOB"/>
    <field name="name" default-fetch-group="false" >
    <extension vendor-name="kodo" key="fetch-group" value="TestClob_name"/>
    <extension vendor-name="kodo" key="data-column" value="NAME"/>
    </field>
    <field name="dataClob" default-fetch-group="false"
    persistence-modifier="persistent">
    <extension vendor-name="kodo" key="fetch-group" value="TestClob_dataClob"/>
    <extension vendor-name="kodo" key="data-column" value="CLOB_DATA"/>
    <extension vendor-name="kodo" key="jdbc-size" value="-1"/>
    </field>
    </class>
    Oracle DB table:
    CREATE TABLE test_clob (
    ID NUMBER ( 10 ) NOT NULL,
    NAME VARCHAR2 ( 255 ) NOT NULL,
    clob_data clob,
    LAST_UPDATE NUMBER(18),
    PRIMARY KEY (ID)
    mapping file:
    <class name="TestClob">
    <jdbc-class-map type="base" table="TEST_CLOB" pk-column="ID" />
    <field name="name">
    <jdbc-field-map type="value" column="NAME"/>
    </field>
    <field name="dataClob">
    <jdbc-field-map type="clob" column="CLOB_DATA"/>
    </field>
    </class>
    Error log:
    - <t -1133534024, conn 5> [10 ms] executing prepstmnt 14 INSERT INTO
    OSS_INV.TES
    T_CLOB (CLOB_DATA, ID, LAST_UPDATE, NAME) VALUES (?, ?, ?, ?) [params=(Clob)
    ora
    cle.sql.CLOB@5f4e2d, (long) 1215, (long) 12, (String) nazwa]
    - <t -1133534024, conn 5> [20 ms] executing prepstmnt 15 SELECT t0.CLOB_DATA
    FRO
    M OSS_INV.TEST_CLOB t0 WHERE t0.ID = ? FOR UPDATE [params=(long) 1215]
    - An exception occurred while ending the transaction. This exception will
    be re
    -thrown.
    kodo.util.FatalDataStoreException: ORA-01002: fetch out of sequence
    {prepstmnt 15 SELECT t0.CLOB_DATA FROM OSS_INV.TEST_CLOB t0 WHERE t0.ID = ?
    FOR
    UPDATE [params=(long) 1215]} [code=1002, state=72000]
    NestedThrowables:
    com.solarmetric.jdbc.ReportingSQLException: ORA-01002: fetch out of sequence
    {prepstmnt 15 SELECT t0.CLOB_DATA FROM OSS_INV.TEST_CLOB t0 WHERE t0.ID = ?
    FOR
    UPDATE [params=(long) 1215]} [code=1002, state=72000]
    java.sql.SQLException: ORA-01002: fetch out of sequence
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:42)
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:24)
    at
    kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:510)
    at
    kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java
    :158)
    at
    kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerI
    mpl.java:788)
    at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManag
    erImpl.java:644)
    at
    weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
    erSCInfo.java:1010)
    at
    weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
    rverSCInfo.java:115)
    at
    weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
    dChain(ServerTransactionImpl.java:1142)
    at
    weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
    ServerTransactionImpl.java:1868)
    at
    weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
    rverTransactionImpl.java:250)
    at
    weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
    sactionImpl.java:221)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.jav
    a:416)--
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • LONG, CLOB problems

    Platform: Win2k, Ora9i, Toplink9i, OCI driver, jdk1.3.1_01
    I'm having trouble with storing long strings using Toplink. I'm using a LONG column, and the text is getting truncated from around 8000 characters to about 5600.
    While trying to figure out what was going on, I discovered a warning from Oracle saying that LONGs should not be used, instead a CLOB was appropriate (why does the Toplink SchemaManager generate LONGs then?). So I thought I'd try the experiment again with CLOBs. I dropped the schema and recreated it, using CLOB NULL everywhere I'd used LONG NULL before.
    Unfortunately, when I run the same code on the CLOBized schema, I get the error below. Does anyone have any idea how to get either LONGs or CLOBs to do the job I need?
    Thanks,
    Bryn
    p.s. Sorry if this (or something very like it) gets posted twice, the forums server seems to have dropped my session between previewing and posting so I had to redo it.
    EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exception
    s.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-03124: two-task internal error
    INTERNAL EXCEPTION: java.sql.SQLException: ORA-03124: two-task internal error
    ERROR CODE: 3124
    at oracle.toplink.exceptions.DatabaseException.sqlException(Unknown Sour
    ce)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirect
    NoSelect(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeNoSele
    ct(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(U
    nknown Source)
    at oracle.toplink.publicinterface.UnitOfWork.executeCall(Unknown Source)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall
    (Unknown Source)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall
    (Unknown Source)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.insertObjec
    t(Unknown Source)
    at oracle.toplink.internal.queryframework.StatementQueryMechanism.insert
    Object(Unknown Source)
    at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertO
    bjectForWrite(Unknown Source)
    at oracle.toplink.queryframework.InsertObjectQuery.executeCommit(Unknown
    Source)
    at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.perform
    UserDefinedWrite(Unknown Source)
    at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.perform
    UserDefinedInsert(Unknown Source)
    at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.insertO
    bjectForWrite(Unknown Source)
    at oracle.toplink.queryframework.WriteObjectQuery.executeCommit(Unknown
    Source)
    at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.execute
    Write(Unknown Source)
    at oracle.toplink.queryframework.WriteObjectQuery.execute(Unknown Source
    at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
    at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown S
    ource)
    at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(Unknow
    n Source)
    at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
    at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
    at oracle.toplink.internal.sessions.CommitManager.commitAllObjects(Unkno
    wn Source)
    at oracle.toplink.publicinterface.Session.writeAllObjects(Unknown Source
    at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(Unknown So
    urce)
    at oracle.toplink.publicinterface.UnitOfWork.commitRootUnitOfWork(Unknow
    n Source)
    at oracle.toplink.publicinterface.UnitOfWork.commit(Unknown Source)

    Using the Oracle8Platform instead of OraclePlatform will tell TopLink to generate CLOBs instead of LONGs and BLOBs instead of LONG RAWs.
    As for the error, I have never seen this error before. Your best bet is probably to contact Oracle database support.
    Peter Krogh

  • Xmldom.writetoclob hanging forever when writing a domnode to a temp clob

    Hi
    Wondering has anyone come across anything similar (or know a work around)
    1. Basically the the procedure below loads an XML file. (OK)
    2. Removes reference to external dtd, ref was causing and error (OK)
    3. Parses the XML (OK)
    4. Gets a list of the "item" tags (OK) - should be up to 500 item elements in XML
    5. Loops on all elements
    a. writes node to temp clob *(PROBLEM HERE)*
    b. Creates xmltype from clob (OK)
    c. transforms xmltype and assigns to another xmltype (OK)
    d. inserts new xmltype (OK)
    This procedure is used by a threaded os java app to load thousands of files to db.
    It works fine 99% of the time but for some files the procedure is hanging at (5.a : write domnode to clob using xmldom.writetoclob)
    I am absolutely sure the problem is due to the characters in the domnode as all files that have hung on processing contain these bizarre characters,
    the db character set is Unicode AL32UTF8 so it should be able to handle almost anything, saying that, if the it is a prob with the characters then why does
    the loadclobfromfile procedure succeed.
    Developed on Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
    I have no prob rejecting node and continue processing but procedure just hangs and i have to kill the thread on the os.
    Is there a way to
    1. Test for invalid AL32UTF8 chars and skip on error.
    or
    2. Get around the xmldom.writetoclob procedure and create an xmltype from the xmldom.domnode (i tried to convert domnode -> domdocument -> xmltype, no joy)
    or
    Open to suggestions
    PROCEDURE
    PROCEDURE process_blog_xml_file (
          p_file_name     IN   VARCHAR2,
          p_insert_date   IN   VARCHAR2,
          p_dir           IN   VARCHAR2 DEFAULT NULL
       IS
          newsurl        VARCHAR2 (80);
          parser         xmlparser.parser;
          newsxml        xmldom.domdocument;
          titles         xmldom.domnodelist;
          titles_found   NUMBER;
          curnode        xmldom.domnode;
          textchild      xmldom.domnode;
          dest_clob      CLOB;
          l_temp_clob    CLOB;
          src_clob       BFILE         := BFILENAME (g_zip_file_dir, p_file_name);
          dst_offset     NUMBER             := 1;
          src_offset     NUMBER             := 1;
          lang_ctx       NUMBER             := DBMS_LOB.default_lang_ctx;
          warning        NUMBER;
          l_xml          XMLTYPE;
          xsldata        XMLTYPE;
          xmldata        XMLTYPE;
          l_dir          VARCHAR2 (1000);
       BEGIN
          LOG (   'Start Processing file '
               || p_file_name
               || ' from zip '
               || p_insert_date
          IF p_dir IS NULL
          THEN
             SELECT directory_path
               INTO l_dir
               FROM all_directories
              WHERE directory_name = g_zip_file_dir;
          ELSE
             l_dir := p_dir;
          END IF;
          IF g_xsl_clob IS NULL
          THEN
             init_xsl_clob;
          END IF;
          com_polecat_xmldb_utils.set_load_date
                                      (TO_DATE (REPLACE (REPLACE (p_insert_date,
                                                         '.zip',
                                                'DD-MM-YYYY'
          LOG ('ITEM.Loaddate set : ' || com_polecat_xmldb_utils.get_load_date);
          xsldata := XMLTYPE.createxml (g_xsl_clob);
          LOG ('Read xsl file to clob');
          DBMS_LOB.OPEN (src_clob, DBMS_LOB.lob_readonly);
          DBMS_LOB.createtemporary (dest_clob, TRUE);
          DBMS_LOB.loadclobfromfile (dest_lob          => dest_clob,
                                     src_bfile         => src_clob,
                                     amount            => DBMS_LOB.getlength
                                                                         (src_clob),
                                     dest_offset       => dst_offset,
                                     src_offset        => src_offset,
                                     bfile_csid        => NLS_CHARSET_ID
                                                                       ('AL32UTF8'),
                                     lang_context      => lang_ctx,
                                     warning           => warning
          LOG ('Read xml file to clob');
          DBMS_LOB.CLOSE (src_clob);
          parser := xmlparser.newparser;
          dest_clob := REPLACE (dest_clob, g_blog_dtd_remove, '');
          LOG ('Parse xml ');
          xmlparser.parseclob (parser, dest_clob);
          DBMS_LOB.freetemporary (dest_clob);
          newsxml := xmlparser.getdocument (parser);
          xmlparser.freeparser (parser);
          titles := xmldom.getelementsbytagname (newsxml, 'item');
          LOG ('Load  blogs items to ITEM table. ');
          FOR j IN 1 .. xmldom.getlength (titles)
          LOOP
             curnode := xmldom.item (titles, j - 1);
             DBMS_LOB.freetemporary (l_temp_clob);
             DBMS_LOB.createtemporary (l_temp_clob, TRUE);
             LOG ('write node to temp clob ' || j);
             xmldom.writetoclob (curnode, l_temp_clob);                                              <-- Hanging Here
             LOG ('create xml type from clob ' || j);
             l_xml := XMLTYPE.createxml (l_temp_clob);
             LOG ('apply xsl transform to xml ' || j);
             xmldata := l_xml.transform (xsldata);
             LOG ('Insert to item table  ' || j);
             BEGIN
                INSERT INTO item
                     VALUES (xmldata);
             EXCEPTION
                WHEN OTHERS
                THEN
                   LOG ('Error::  ' || SQLERRM);
             END;
          END LOOP;
          xmldom.freedocument (newsxml);
          LOG (   'Finished Processing file '
               || p_file_name
               || ' from zip '
               || p_insert_date
       EXCEPTION
          WHEN OTHERS
          THEN
             LOG (SQLERRM);
       END;note variables starting with g_ are defined in package spec
    Cheers
    Ian
    Edited by: user3604054 on 01-Apr-2010 06:52
    Edited by: user3604054 on 01-Apr-2010 14:57
    Edited by: user3604054 on 01-Apr-2010 15:00
    Edited by: user3604054 on 01-Apr-2010 15:00
    Edited by: user3604054 on 01-Apr-2010 15:05
    Edited by: user3604054 on 01-Apr-2010 15:06

    2. Get around the xmldom.writetoclob procedure and create an xmltype from the xmldom.domnode (i tried to convert domnode -> domdocument -> xmltype, no joy) Which version of Oracle (4 digits)?
    Also look in the FAQ in the upper right for how to use the tag to wrap PL/SQL to retain formatting to make it easier for all to read.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SQL Loader, CLOB, delimited fields

    Hello.
    I have to load using SQL Loader data from csv file into table, which one field is CLOB type.
    Here is how ctl file initially looked like:
    UNRECOVERABLE
    LOAD DATA
    INFILE '.\csv_files\TSH_DGRA.csv'
    BADFILE '.\bad_files\TSH_DGRA.bad'
    DISCARDFILE '.\dsc_files\TSH_DGRA.dsc'
    APPEND
    INTO TABLE TSH_DGRA
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    ID_OBJ_TSHD,
    PR_ZOOM_TSHD,
    PR_GRID_TSHD,
    PR_ELMGR_TSHD CHAR(4000) OPTIONALLY ENCLOSED BY '<clob>' AND '</clob>',
    PR_ALRMGR_TSHD CHAR(4000) OPTIONALLY ENCLOSED BY '<clob>' AND '</clob>'
    Problems are fields PR_ELMGR_TSHD and PR_ALRMGR_TSHD (CLOBs in table TSH_DGRA). Until data which should be loaded into CLOB fields are under 4000 characters long, it works fine, but what should I do if I want to load data which are longer than 4000 characters?
    If found on Link:[http://download.oracle.com/docs/cd/B14117_01/server.101/b10825/ldr_loading.htm#i1006803] which one sentence said that:
    "SQL*Loader defaults to 255 bytes when moving CLOB data, but a value of up to 2 gigabytes can be specified. For a delimited field, if a length is specified, that length is used as a maximum. If no maximum is specified, it defaults to 255 bytes. For a CHAR field that is delimited and is also greater than 255 bytes, you must specify a maximum length. See CHAR for more information about the CHAR datatype."
    So, my question is, how to specify "up to 2gb" as text said? I can not use CHAR datatype because it is limited to 4000 characters. And I have to load about 60000 characters. I also can not use technique where all data for every CLOB field are in separate files.

    Just specify the maximum expected size:
    PR_ELMGR_TSHD CHAR(100000) OPTIONALLY ENCLOSED BY '<clob>' AND '</clob>',
    PR_ALRMGR_TSHD CHAR(1000000) OPTIONALLY ENCLOSED BY '<clob>' AND '</clob>'
    The CHAR(1000000) will allow SQLLDR to handle up to 1000000 bytes of input text.

  • Problem in Schemas import from one database to another

    Hi,
    I have to import the schemas from one database (10g release 1) to another database (10g release 1).
    But the problem is that through simple import (imp) the system privileges, object privileges & other things are not importing to import file. There are various objects in the schemas which are inter-related & I can't manually grant on those objects.
    I have also tried Toad Export DDL Script. But my problem is not solve through the Toad. There are other various issues occuring with TOAD.
    I have also tried SQL Developer & PL/SQL Developer but CLOB problem is occuring with them.
    The schemas which I have been creating in different database is new schemas with same name.
    AB
    Edited by: adhondiyal on Dec 26, 2010 8:55 AM

    adhondiyal wrote:
    Hi,
    I have to import the schemas from one database (10g release 1) to another database (10g release 1).
    But the problem is that through simple import (imp) the system privileges, object privileges & other things are not importing to import file. There are various objects in the schemas which are inter-related & I can't manually grant on those objects.
    I have also tried Toad Export DDL Script. But my problem is not solve through the Toad. There are other various issues occuring with TOAD.
    I have also tried SQL Developer & PL/SQL Developer but CLOB problem is occuring with them.
    ABWhy can't you use EXPDP/IMPDP
    have you given grants=y ?
    mp system/***** file=schema.dmp log=schema.log fromuser=user1 touser=user2 grants=yis the usernames of source & dest are same?
    use as if schema name is same
    expdp system/**** directory=DATA_PUMP_DIR dumpfile=schema.dmp logfile=schema.log schemas=users
    impdp system/**** dumpfile=schema.dmp logfile=schema1.log
    if schema name is different then
    expdp system/**** directory=DATA_PUMP_DIR dumpfile=schema.dmp logfile=schema.log schemas=users
    impdp system/**** dumpfile=schema.dmp logfile=schema1.log remap_schema=(source:dest)
    Thanks

  • LOB locater from Java?

    I seem to be having a problem with getting a CLOB from a Java stored procedure. I have
    public class TheJava {
    public static CLOB getData(int arg){. . .
    which is specified by
    FUNCTION getClobData(a IN NUMBER)RETURN CLOB
    AS LANGUAGE JAVA
    NAME 'TheJava.getData(int) return oracle.sql.CLOB'
    I also have the utility procedure to write it out
    PROCEDURE printClobOut(result IN OUT NOCOPY CLOB) is
    xmlstr varchar2(32767);
    line varchar2(2000);
    begin
    xmlstr := dbms_lob.SUBSTR(result,32767);
    loop
    exit when xmlstr is null;
    line := substr(xmlstr,1,instr(xmlstr,chr(10))-1);
    dbms_output.put_line('| '||line);
    xmlstr := substr(xmlstr,instr(xmlstr,chr(10))+1);
    end loop;
    end;
    So if I try
    declare
    c CLOB;
    begin
    dbms_lob.createtemporary(c,true);
    c:=getlegendasxml(1);
    printclobout(c);
    dbms_lob.freetemporary(c);
    end;
    I get
    ORA-22275: invalid LOB locator specified
    ORA-06512: at "SYS.DBMS_LOB", line 739
    ORA-06512: at "PRINTCLOBOUT", line 5
    ORA-06512: at line 6
    Really, I have no idea what I have to do to get the right locater. Any suggestions are much appreciated.

    Yes, I suspect it is the Java that is causing the problem. The code is below. I can't see that there is anything unusual here so why should there be a locater problem?
    import java.io.IOException;
    import java.io.Writer;
    import java.sql.*;
    import oracle.sql.CLOB;
    public class TheJava {
    public static CLOB getData(int arg) throws SQLException{
    Connection conx = null;
    String message = new String();
    CLOB tempClob = null;
    Writer tempClobWriter = null;
    try{
    conx = DriverManager.getConnection("jdbc:default:connection:");
    tempClob = oracle.sql.CLOB.createTemporary(conx, true, oracle.sql.CLOB.DURATION_SESSION);
    tempClob.open(oracle.sql.CLOB.MODE_READWRITE);
    tempClobWriter = tempClob.getCharacterOutputStream();
    }catch(SQLException sqlexp){
    message = "! CLOB problem.\n ";
    message += sqlexp.getMessage();
    if(tempClob!=null){
    //line A is next line
    tempClob.putString(1,message);
    return tempClob;
    }//end if tempclob
    }catch(Exception exp){
    message = "! Some other exception.\n ";
    message += exp.getMessage();
    if(tempClob!=null){
    tempClob.putString(1,message);
    return tempClob;
    }//end if tempclob
    }finally{
    if(tempClob!=null){ tempClob.freeTemporary(); }
    if(conx != null){ conx.close(); }
    }//end try catch
    In an earlier test I was getting an error reported at line A (I had tried to start from position 0).

  • Problem on CLOB datatype after import

    I got problem and call to Oracle support and they use DUL for extract data from datafile to dump file and I import everything is done and no error but when I check in CLOB datatype that have space(blank character) separate each character see below
    Original
    Oracle
    After Import
    O R A C L E
    So the application cannot execute those data.
    Anyone have solution how to fix this problem?
    Thanks,
    Taohiko

    if you use a direct insert you are restricted to 4000 characters.
    You can put your value in a varchar2 variable and that allows you to insert up to 32767 characters.
    declare
    my_clob_variable := rpad('x','X',25000);
    begin
    insert into my_table(my_clob_column)
    values(my_clob_variable);
    end;

Maybe you are looking for

  • Calendar in yosemite

    Im using Yosemite 10.10.1/iMac 21,5 inch,late 2009 Calendar: in the "year" view i see all month and days weeks fine. But the weeks number are wrong. For example, in June 2014, I see beside of each week, the number 2, same as July in August the number

  • Error message: no printer is selected. How do I do it in PS6 64 bit

    Get the message that I have to select the printer when I try to print. Then open a new photo and print it. Where do I choose a printer?

  • Problem printing to a PC based HP from MAC OSX 10.3.9 w/ router

    I have the following Belkin Router; F5D7230-4. The router is hardwired to the PC and has a F380 (F300 series) HP printer USB hardwired. I also have a iMAC G5 OS x 10.3.9 which is online, connected to the router via a ethernet cable. I have no wireles

  • Two forms on same page..save state of one form while submitting other.

    Hi.... I have 2 form on same page.... first is form on table.... nd another is tabular form..... now if I make an entry in both table ,,,,and after entering data in tabular form if click on submit button of tabular for the data of tabular form get su

  • PC to mac how to move itunes?!

    Hi! I just switched from a sony vaio to a macbook. I can't figure out how to transfer my itunes library from my pc to my mac. Any help would be great! Thanks!