java中异常如上:
存储过程如下:
CREATE DEFINER=`root`@`localhost` PROCEDURE `inCharge`(
in depId int,                     /*入库明细*/
in comId int,                  /*门诊编号*/
in doctorId int,                  /*医生编号*/
in nurseId int,                  /*护士编号*/
in patient varchar(20),            /*病人姓名*/      
in patAge int,                  /*病人年龄*/
in chaTime varchar(20) ,           /*时间*/    
out chid int,  /*收费Id*/  
in chaType int,                  /*费用类型*/
in patSex varchar(20)            /*性别*/     
                       
)
begin程序中调用如下:String sql = "{call inCharge(?,?,?,?,?,?,?,?,?,?)}";
int result=0;
try {
 ps = con.prepareCall(sql);
ps.setInt(1, charge.getDepId());
ps.setInt(2, charge.getComId());
ps.setInt(3, charge.getDoctorId());
ps.setInt(4, charge.getNurseId());
ps.setString(5, charge.getPatient());
ps.setInt(6, charge.getPatAge());
ps.setString(7, charge.getChaTime());
ps.setInt(9, charge.getChaType());
ps.setString(10, charge.getPatSex());
ps.registerOutParameter(8, java.sql.Types.INTEGER);
ps.execute();
result= ps.getInt(8);异常如下:
java.sql.SQLException: Parameter number 8 is not an OUT parameter
很是奇怪。