java调用以下存储过程时报错:
--1.创建一个包,在该包中定义了一个游标类型yh_cursor1
create or replace package testpackage as type test_cursor is ref cursor;
end testpackage;
--2.创建存储过程
create or replace procedure sp_13(spNo in number,p_cursor out testpackage.test_cursor) is begin open p_cursor for select * from emp where deptno=spNo;
end sp_13;
console打印的异常信息:
java.sql.sqlException: 类型长度大于最大值
at oracle.jdbc.driver.DatabaseError.throwsqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwsqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:885)
at oracle.jdbc.driver.T4CMAREngine.buffer2Value(T4CMAREngine.java:2231)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB2(T4CMAREngine.java:1048)
at oracle.jdbc.driver.T4CTTIdcb.receiveCommon(T4CTTIdcb.java:112)
at oracle.jdbc.driver.T4CTTIdcb.receiveFromRefCursor(T4CTTIdcb.java:104)
at oracle.jdbc.driver.T4CResultSetAccessor.unmarshalOneRow(T4CResultSetAccessor.java:165)
at oracle.jdbc.driver.T4CTTIrxd.unmarshal(T4CTTIrxd.java:785)
at oracle.jdbc.driver.T4CTTIrxd.unmarshal(T4CTTIrxd.java:702)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:527)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:180)
at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableStatement.java:783)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1027)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2885)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:2976)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4103)
at com.huihui.test3.OracleTest.main(OracleTest.java:29)
java.sql.sqlException: 违反协议
at oracle.jdbc.driver.DatabaseError.throwsqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwsqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:885)
at oracle.jdbc.driver.T4C7Ocommoncall.receive(T4C7Ocommoncall.java:133)
at oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:385)
at oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:1036)
at com.huihui.test3.OracleTest.main(OracleTest.java:48)
解决办法:
用oracle自带ojdbc14.jar (1.5m)替换weblogic81/server/lib下的ojdbc14.jar(1.3m)