I am trying to call the Oracle stored procedure in java. I have given below,stored procedure and java method which calls the stored procedure and returns the result set. I am getting the error Invalid column type :1111 or invalid column index.
Can anyone tell me whats wrong in the code
Oracle Stored Procedure:
CREATE OR REPLACE spDisplayBook
(
cur_out OUT PACK_OGPT.t_cursor
)
AS
BEGIN
OPEN cur_out FOR
SELECT
title,author
FROM book;
END spDisplayBook;
/
private ResultSet execSQL(String sqlStr) throws Exception {
if (con==null) {
System.err.println("Database connection is closed.");
System.exit(4);
}
ResultSet rs=null;
try {
String query = "begin ? := spDisplayBook; end;";
CallableStatement statement = con.prepareCall (query);
statement.registerOutParameter(1, OracleTypes.OTHER);
statement.execute();
rs = (ResultSet)statement.getObject(1);
while (rs.next())
{
System.out.println(rs.getString(1).toString()+ rs.getString(2).toString());
}
}
catch (SQLException sqle) {
System.err.println("Check your SQL statement:");
int ErrCode = sqle.getErrorCode();
String str = sqle.getMessage();
sqle.printStackTrace();
close();
System.exit(5);
}
return rs;
}}