Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> ORA-01461 Error for CLOB PLease help
Hai ,
I have a table as described below.
PRICE_BUNDLE_CODE
Name Null? Type ------------------------------- -------- --------------------------------- -------------------------- PRICE_BUNDLE_ID NOT NULL NUMBER(5) BUNDLE_CODE NOT NULL VARCHAR2(20) COUNTRY_ID NOT NULL NUMBER(5) SOLUTION_ID NOT NULL NUMBER(5) DESCRIPTION NOT NULL VARCHAR2
(200)
PRICING_SCHEDULES NOT NULL CLOB
In the above table PRICE_BUNDLE_ID is generated by sequence generator.
I read Bundle_code, country_id,solution_id, description and PRICING_SCHEDULES from the user into a String,int,int,String and String type variables.The PRICING_SCHEDULES is usually some large text.
I tried using the code below to insert a new row into the above table.
public boolean createEntity()
{
//Here BundleCode is an object with 5 data fields.I use this.bundleId,this.bundleCode,etc to retrieve the values of the fields from the object
System.out.println("Call to createEntity is made in Bundle Code"); System.out.println("Bundle
:"+this.countryId+"SolutionId :"+this.solutionId+"Pricing : "+this .bundlePricingDetails);
JdbcConnection connectionBean=null; Connection conn=null; ResultSet rs=null; try{ connectionBean=JdbcBeanFactory.getJdbcConnectionBeanInstance("geisnet"); connectionBean.leaseConnection(); conn=connectionBean.getConnection(); String pricing=new String(this.bundlePricingDetails); PreparedStatement stmt=conn.prepareStatement("INSERT INTOPRICE_BUNDLE_CODE (BUNDLE_CODE, COUNTRY_ID, SOLUTION_ID,
DESCRIPTION,PRICING_SCHEDULES) VALUES (?,?,?,?,?)"); stmt.setString(1,this.bundleCode); stmt.setInt(2,this.countryId); stmt.setInt(3,this.solutionId); stmt.setString(4,this.bundleDescription); stmt.setClob(5,new oracle.sql.CLOB
((oracle.jdbc.driver.OracleConnection) conn,pricing.getBytes()));
stmt.executeUpdate(); stmt.close(); rs.close(); } catch(SQLException sqle) { System.out.println("Sql exception Caught in the PoolTesting file try block"+sqle); } catch(Exception e) { System.out.println("Generic Exception caught in BundleCode class"+e); } finally { if(connectionBean!=null) connectionBean.returnConnection(); } } return true;
It results in an exception as shown below.
Sql exception Caught in the PoolTesting file try blockjava.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
Can any of you please solve this problem as soon as possible?Please give some details abouut updationg the CLOB field too?
-Kishore Babu Chekuri
-- Posted via CNET Help.com http://www.help.com/Received on Sat Oct 21 2000 - 02:30:04 CDT
![]() |
![]() |