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!

how to handle large PL/SQL return string in JDBC Java

616837Jan 9 2008 — edited Jan 10 2008
Hi all,

I have a PL/SQL function that returns a large string (more than 4000), when I run it in SQL*PLUS it works fine. But when I try to invoke it via Java JDBC as follows:

String sqlStmt = ("{? = call TEST.PLSQLFUNCTION(?)}");
cStmt = (OracleCallableStatement)this.myConn.prepareCall(sqlStmt);
cStmt.registerOutParameter(1,oracle.jdbc.OracleTypes.VARCHAR);
cStmt.setBigDecimal(2,pExtractId);
cStmt.execute();
result = cStmt.getString(1);


I run into the following exception

java.sql.SQLException: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1

08/01/09 17:09:42 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
08/01/09 17:09:42 at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
08/01/09 17:09:42 at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)


I know this probably has something to do with the limit of SQL varchar2 data type of only 4000. I am running java version 1.4 Is there any way to circumvent this issue?

Thanks in advance for your help !!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 7 2008
Added on Jan 9 2008
4 comments
597 views