quote:
Originally posted by:
dianemk
I'll try <cfquery> and see what happens. Unfortunately,
that isn't a long-term solution for me since my actual stored proc
is complex. I'll report back what happens. Thanks.
If you use JDBC, then execute a call to store procedure via
cfscript works.
Sample using Oracle Thin driver.
<!--- text to be insert into a clob field which is larger
than 32,767 chars long --->
<cfset someLargeText = "blah...."/>
<cfscript>
OracleTypes = CreateObject("java",
"oracle.jdbc.driver.OracleTypes");
CLOB = CreateObject("java", "oracle.sql.CLOB");
ds = CreateObject("java",
"oracle.jdbc.pool.OracleDataSource");
ds.setDriverType("thin");
ds.setServerName("HOSTNAME");
ds.setPortNumber("PORT");
ds.setDatabaseNAme("DBNAME");
ds.setUser("USERNAME");
ds.setPassword("PASSWORD");
con = ds.getConnection();
tempClob = CLOB.createTemporary(con, false,
CLOB.DURATION_CALL);
tempClob.open(CLOB.MODE_READWRITE);
tempClobWriter = tempClob.getCharacterOutputStream();
tempClobWriter.write(someLargeText);
tempClobWriter.flush();
tempClobWriter.close();
tempClob.close();
cs = con.prepareCall("call pkg_clob_test.ins(?,?)");
cs.setClob(1, tempClob);
cs.registerOutParameter(2, OracleTypes.INTEGER);
cs.execute();
id = cs.getInt(2);
cs.close();
con.close();
WriteOuptut("The ID return by the insert operation is: "
& id);
</cfscript>
It is a far from perfect but better then cfquery if your
store procedure is complex.
I did email the bug to Adobe's QA team, got a reply from
them, then sent them a test case which should fail when it attempt
to send a clob via a stored procedure. However, they did ran the
test and it pass at their end so maybe the next version (update?)
of ColdFusion will fix the cf_sql_clob issue?