gpt4 book ai didi

java - 我不确定出了什么问题 "Parameter number 2 is not an OUT parameter"

转载 作者:行者123 更新时间:2023-12-01 18:11:14 29 4
gpt4 key购买 nike

 try{
Class.forName("com.mysql.jdbc.Driver");
mycon = DriverManager.getConnection("jdbc:mysql://localhost:3306/schoolDb?autoReconnect=true&useSSL=false", "root", "Banita");
CallableStatement cs = mycon.prepareCall("{call showData(?, ?, ?)}");


cs.setInt(1, 20);
cs.registerOutParameter(2, Types.INTEGER);
cs.registerOutParameter(3, Types.CHAR);

cs.executeUpdate();

} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}

我在这里对创建过程参数做了什么吗?

CREATE DEFINER=`root`@`localhost` PROCEDURE `showData`(in id int, out deptNO int, out LOC char(12))
BEGIN
select DEPTNO, LOC INTO deptNO, LOC from schooolDb.UDP_DEPT_DNAME where deptNO = id;
END

最佳答案

尝试

CREATE DEFINER=`root`@`localhost` PROCEDURE `showData`(in id int, out o_deptno int, out o_loc char(12))
BEGIN
select DEPTNO, LOC INTO o_deptno, o_loc from schooolDb.UDP_DEPT_DNAME where DEPTNO = id;
END

关于java - 我不确定出了什么问题 "Parameter number 2 is not an OUT parameter",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60466248/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com