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 -> ORA 1461 Error while trying to insert into a CLOB column

ORA 1461 Error while trying to insert into a CLOB column

From: Ajay Damani <damani_at_uts.cc.utexas.edu>
Date: Mon, 30 Nov 1998 14:13:21 -0600
Message-ID: <Pine.OSF.4.05.9811301408560.4188-100000@curly.cc.utexas.edu>

Hi folks!

I am getting the following error while trying to insert something into an Oracle8 database:

"java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column"

I am using v8.0.5.0.5 of the JDBC drivers obtained from Oracle together with JDK 1.1.6. My column type is a CLOB and this only happens while trying to insert something over a certain size (i believe that the size limit is 4k). My question is as follows:

  1. Is there a better way to insert something into a CLOB column of an Oracle8 database without encountering the above error message and overcoming the size limit? Currently I am using the following code:

// this can be something as big as you can imagine.
   String mydata = "something really really long.........";    int len = mydata.length();    

   BytaArrayInputStream bais = new ByteArrayInputStream(mydata.toBytes());    PreparedStatement ps = conn.prepeareStatement("insert into mytable values (?)");

   ps.setAsciiStream(1,bais,len);
// Also tried the following:
// ps.setString(1,outputstream.toString());
   ps.execute();
   ps.close();

   This does the insert for data of a certain size but croaks on anything    that is over the size limit.    

2. If I can somehow convert my string (mydata) to an OracleClob, then I

    can use the setClob method to do the insert. Can I do this?

Any help is greatly appreciated. Thanks.

-Ajay Received on Mon Nov 30 1998 - 14:13:21 CST

Original text of this message

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