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;
精彩评论