我收到此错误“偏移量5处格式错误的函数或过程转义语法”。当我运行以下代码时:
public void callPro(int id) {
int inv_id = id;
int cust_id = 0;
try {
Connection conn = connect();
CallableStatement cstmt = conn.prepareCall("{? = inventory_held_by_customer(?)}");
cstmt.setInt(2, inv_id);
cstmt.registerOutParameter(1, Types.INTEGER);
cstmt.execute();
cust_id = cstmt.getInt(1);
System.out.println(cust_id);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
有任何解决错误的建议吗?
答案 0 :(得分:0)
找到了解决方法,我在prepareCall的语句中错过了“ call”关键字:CallableStatement cstmt = conn.prepareCall(“ {?=调用stocker_held_by_customer(?)}”);