1
我有一個存儲過程我如何通過一個遊標作爲參數傳遞給存儲過程,並抓住它背在java中
CREATE OR REPLACE FUNCTION fun_retrieve_vector_receipt_payment_details(character varying, integer, character varying, character varying, character varying, refcursor) RETURNS refcursor AS
這是我的java代碼
con.setAutoCommit(false);
String sql = "{call fun_retrieve_vector_receipt_payment_details(?,?,?,?,?,?)}";
callableStatement = con.prepareCall(sql);
callableStatement.setString(1, "PAYMENT");
callableStatement.setInt(2, 41);
callableStatement.setString(3, "2011-05-06");
callableStatement.setString(4, "2013-05-06");
callableStatement.setString(5, "Y");
callableStatement.setObject(6, rs);
callableStatement.registerOutParameter(6, Types.OTHER);
callableStatement.execute();
ResultSet resultSet = (ResultSet) callableStatement.getObject(6);
// rs = callableStatement.executeQuery();
boolean next = resultSet.next();
if (next)
{
System.out.println(resultSet.getString(1));
}
爲什麼我得到結果集,作爲空值?
我應該通過refcursor作爲參數從java傳遞什麼?
我使用的Postgres作爲我的數據庫
什麼是rs,你從哪裏取得它? –