请给一个示例,非常感谢
------解决方案--------------------
try{
int price = 10;
String name = "pencil ";
//需要使用的参数 我是随便写举例
CallableStatement proc = connection.prepareCall( "{ call ******(?, ?) } ");
//****为存储过程名
proc.setInt(1, price);
proc.setString(2, name);
cs.execute();
}catch (SQLException e){ // ....}
------解决方案--------------------
给个例子:
try
{ CallableStatement stmt = conn.prepareCall( "{call accept_pp(?,?,?,?)} ");//四个参数,最后一个是out类型
stmt.setString(1,countryType);
stmt.setString(2,sql);
stmt.setString(3,tableName);
stmt.registerOutParameter(4,OracleTypes.NUMBER);
stmt.execute(); //执行
totalNum = ((OracleCallableStatement)stmt).getInt(4);//返回值
}
catch (SQLException ex)
{
ex.printStackTrace();
}