存储过程:有参数

String rSet=null;
CallableStatement cStatement=null;
try {
cStatement=connection.prepareCall("{Call sellTicketPROC(?,?,?,?,?,?,?)}");
cStatement.setString(1, lineID);
cStatement.setString(2, beginStation);
cStatement.setString(3, endStation);
cStatement.setString(4, date);
cStatement.setString(5, TrainNum);
cStatement.setString(6, seatTyle);
cStatement.registerOutParameter(7,Types.VARCHAR);
cStatement.execute();
rs=cStatement.getString(7);//得到输出结果




调用函数:


sql="{?=call function_test(?,?)}";
st.registerOutParameter(1, Types.VARCHAR);
cStatement.setString(2, lineID);
cStatement.setString(3, beginStation);