I\'m writing some JDBC code which calls a Oracle 11g PL/SQL procdedure which has a Custom Object return type. Whenever I try an register my return types, I get either ORA-0
I finally (with a little help from others) found out the answer to this. It came in three parts:
The first was that I needed to use an:
OracleCallableStatement stmt = (OracleCallableStatement) conn.prepareCall(query);
rather than the simple JDBC CallableStatement I had been trying to use.
The second part was that I had to register my "out" parameter as follows:
stmt.registerOutParameter(2, OracleTypes.STRUCT, "DATA_SUMMARY_TAB");
The third part, and it is implicit in part 2 above, was that "DATA_SUMMARY_TAB" had to be in UPPER CASE. If you put it in lower case, then you get a cryptic error message as follows:
java.sql.SQLException: invalid name pattern: MYTEST.data_summary_tab
at oracle.jdbc.oracore.OracleTypeADT.initMetadata(OracleTypeADT.java:553) at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java:469) at oracle.sql.StructDescriptor.initPickler(StructDescriptor.java:390) at oracle.sql.StructDescriptor.(StructDescriptor.java:320)
That's it.
Also, please note our custom object type was not in any packages. If it is, you might need to hack the third parameter around a little.