从 ojdbc6 JDBC 瘦驱动程序访问自定义对象返回类型
我正在编写一些 JDBC 代码,该代码调用具有自定义对象返回类型的 Oracle 11g PL/SQL 过程。我可以获得调用该过程的代码,但如何访问返回的自定义对象以获取其包含的值?我的代码调用该过程的示例如下:
PLSQL 代码:
Procedure GetDataSummary (p_my_key IN KEYS.MY_KEY%TYPE,
p_recordset OUT data_summary_tab,
p_status OUT VARCHAR2);
Java 代码:
String query = "begin manageroleviewdata.getdatasummary(?, ?, ?); end;");
CallableStatement stmt = conn.prepareCall(query);
// Single IN parameter
stmt.setInt(1, 83);
// Two OUT parameters, one a Custom Object, the other a VARCHAR
stmt.registerOutParameter(2, OracleTypes.ARRAY, "DATA_SUMMARY_TAB");
stmt.registerOutParameter(3, OracleTypes.VARCHAR);
stmt.execute(stmt);
如何从中获取结果?
I'm writing some JDBC code which calls a Oracle 11g PL/SQL procdedure which has a Custom Object return type. I can get the code to call the procedure, but how do I access the returned Custom Object to obtain it's contained values?. An example of my code calling the procedure is below:
PLSQL Code:
Procedure GetDataSummary (p_my_key IN KEYS.MY_KEY%TYPE,
p_recordset OUT data_summary_tab,
p_status OUT VARCHAR2);
Java Code:
String query = "begin manageroleviewdata.getdatasummary(?, ?, ?); end;");
CallableStatement stmt = conn.prepareCall(query);
// Single IN parameter
stmt.setInt(1, 83);
// Two OUT parameters, one a Custom Object, the other a VARCHAR
stmt.registerOutParameter(2, OracleTypes.ARRAY, "DATA_SUMMARY_TAB");
stmt.registerOutParameter(3, OracleTypes.VARCHAR);
stmt.execute(stmt);
How do I get the result back fron this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们已经破解了它:
在我们的例子中,这会打印自定义对象类型中的第三个元素。
We've cracked it:
In our case this prints the third element in our Custom Object type.