java ora-01008,java – “ORA-01008:并非所有变量绑定”错误

我使用以下方法通过使用jdbc计算工资单,但“ORA-01008:并非所有变量绑定”错误都没有删除.

有什么想法吗?

我正在使用以下代码

public double getPayroll(){

ResultSet rs = null;

ResultSet rs1 = null;

ResultSet rs2 = null;

Connection conn = null;

PreparedStatement pstmt = null;

try {

conn = getDBConnection();

double dailyPay=0,basicPay=0,payroll2=0;

int houseRent=0,convAllow=0,noOfPresents=0,empId=0;

String q = "select e_id from employee";

pstmt = conn.prepareStatement(q);

rs = pstmt.executeQuery();

while (rs.next()) {

empId=rs.getInt(1);

String q1 = "select count(att_status) from attendance where att_status='p'";

pstmt = conn.prepareStatement(q1);

rs1 = pstmt.executeQuery(q1);

while(rs1.next()){

noOfPresents=rs1.getInt(1);

String q2 = "select e_salary,e_house_rent,e_conv_allow from employee where e_id=?";

pstmt = conn.prepareStatement(q2);

pstmt.setInt(1,empId);

rs2 = pstmt.executeQuery(q2);

while(rs2.next()){

dailyPay=rs2.getInt(1)/22;

houseRent=rs2.getInt(2);

convAllow=rs2.getInt(3);

basicPay=dailyPay*noOfPresents;

payroll2+=basicPay+houseRent+convAllow;

}

}

}

return payroll2;

}catch (Exception e) {

e.printStackTrace();

return 0.0;

} finally {

try {

rs.close();

pstmt.close();

conn.close();

} catch (Exception e) {

e.printStackTrace();

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值