开发者

Spring StoredProcedure

Can we pass the output and input parameter to SQLParameter by index and not by name ?

    /* This code snippet explains data access thru CallableStatement by registering the output and input params by index. */ 

    Connection conn = getConnection();
    CallableStatement sp = conn.prepar开发者_如何学编程eCall("pkg_name.proc_name");
    sp.registerOutParameter(1, oracle.jdbc.driver.OracleTypes.CURSOR);
    sp.registerOutParameter(2, oracle.jdbc.driver.OracleTypes.NUMBER);
    ResultSet rs = (ResultSet) sp.getObject(2);

Here resultset can be fetched based on index.

Please suggest.


Yes we can. Java API doc is your friend.

public void registerOutParameter(String parameterName,
                      int sqlType)
                      throws SQLException;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜