您的位置:首页 > 数据库 > Oracle

java call Oracle procedure 获取返回值

2014-06-10 00:00 405 查看
public void printApplyProc(String p_gv_no, String p_print_type) {

// TODO Auto-generated method stub

String sql = null;

final String pgvno = p_gv_no;

final String pprinttype = p_print_type;

sql = "{CALL E_SHOP_UTIL.PRINT_APPLY(?, ?,?,?)}";//后两个是out put 参数

log.debug("printApplyProc instance");

try {

jdbcTemplate.execute(sql, new CallableStatementCallback() {

public Object doInCallableStatement(CallableStatement cs)

throws SQLException {

cs.setString(1, pgvno);

cs.setString(2, pprinttype);

cs.registerOutParameter(3, Types.VARCHAR);

cs.registerOutParameter(4, Types.VARCHAR);

cs.execute();

return new Integer(cs.getString(3));

}

});

log.debug("printApplyProc successful");

} catch (RuntimeException re) {

log.error("printApplyProc failed", re);

re.printStackTrace();

throw re;

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: