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

Home -> Community -> Usenet -> c.d.o.misc -> Re: writing CLOB data to Oracle 8 using CallableStatements

Re: writing CLOB data to Oracle 8 using CallableStatements

From: Leaton Johnson <leatonjo_at_yahoo.com>
Date: 25 Jan 2002 04:52:40 -0800
Message-ID: <de9bbf63.0201250452.7e82c860@posting.google.com>


Hi,

   I am not sure if this helps. It is an approach which allows you to create a CLOB dynamically without an Oracle table.

   OracleCallableStatement cstmt1 =

      (OracleCallableStatement)
        conn.prepareCall ("begin DBMS_LOB.CREATETEMPORARY(?, TRUE, 
                           DBMS_LOB.SESSION); end;");
    cstmt1.registerOutParameter (1, OracleTypes.CLOB);     cstmt1.execute ();
    pCLOB = cstmt1.getCLOB (1);
    String pName = new String("Prod 1");     pCLOB.putString(1, pName);    

  Lee

"AV" <avek_nospam_at_videotron.ca> wrote in message news:<y7238.5971$%p2.663363_at_weber.videotron.net>...
> http://otn.oracle.com/tech/java/sqlj_jdbc/content.html
>
> http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/content.html
>
> AlexV
>
> "Michael Lawless" <syadnasti_at_hotmail.com> wrote in message
> news:94e3e03.0201210559.68febfdf_at_posting.google.com...
> > Java Developer wrote:
> >
> > There is no such thins as setClob () or setBlob (). You must use
> > setCharacterStream () or something similar [I do not have my docs in
> > front of me right now].
> >
> >
> > Thanks, but I understand that you need some Writer as I have been
> > trying this:
> >
> > oracle.jdbc.driver.OracleConnection oralConn
> > =oracle.jdbc.driver.OracleConnection)myConn;
> >
> > oracle.sql.CLOB clob2 = new oracle.sql.CLOB(oralConn);
> > java.io.Writer writer;
> >
> > // read data into a character array
> > char[] data = {'0','1','2','3','4','5','6','7','8','9'};
> > // write the array of character data to a CLOB
> > writer = (clob2).getCharacterOutputStream();
> > writer.write(data);
> > writer.flush();
> > writer.close();
> >
> > call.setClob(4,clob2 );
> >
> > call.execute();
> >
> > But I am get a NullPointerException
> >
> >
> > Any ideas anyone. I have been looking at the Oracle website, but still
> > there is no hint that i can find on using CallableStatements
Received on Fri Jan 25 2002 - 06:52:40 CST

Original text of this message

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