调用db2存储过程只有一个输出参数 怎么写 call
发布网友
发布时间:2022-04-26 13:28
我来回答
共1个回答
热心网友
时间:2022-06-28 15:30
private CallableStatement call ;
public CallableStatement getCall() {
return call;
}
public void setCall(CallableStatement call) {
this.call = call;
}
public int saveFinanceVoucherRecorded(String userName){
int val = 0 ;
String proc = "" ;
try {
proc = "call p_saveFinanceVoucherRecorded(?)";
call = this.getConnection().prepareCall(proc);
logger.info(proc);
call.registerOutParameter(1, Types.INTEGER);
call.executeUpdate();
val = call.getInt(1);
} catch (Exception e) {
val = 4 ;
e.printStackTrace();
}
return val ;
}
我是这么写的希望能帮到你