Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Convert in JAVA class => String to CLOB

455723Sep 23 2005 — edited Sep 27 2005
Hi!

I just want to convert a simply String or Document type into the Oracle CLOB datatype, beacause I use a stored Procedure with an CLOB argument.
(not to mix with writing a CLOB into a oracle database).

I need some help, I tried this here:

public void setdataPackage(Document data, float cid) {
Connection conn = null;
CallableStatement cs = null;

try {
conn= pool.getConnection(2000);
conn.setAutoCommit(false);

CLOB newClob = CLOB.createTemporary(conn, false, oracle.sql.CLOB.DURATION_CALL);
newClob.setString(1, data.toString());



if(conn != null){
cs = conn.prepareCall("{call SETDATAPACKAGE(?, ?)");
try{
//Inputvalues
cs.setClob(1, newClob);
cs.setFloat(2, cid);

// execute PROCEDURE
cs.execute();
}
catch(Exception e){
System.out.println("CLOB Exception: "+ e);
}
cs.close();
}
else
System.out.println("Connection faild!!!");
}
catch (SQLException e) {
System.out.println("setDataPackage Exception: "+ e);
}
finally{
try{
conn.close();
}
catch(SQLException e){
System.out.println("Connection Close Exception: "+ e);
}
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 25 2005
Added on Sep 23 2005
4 comments
5,924 views