CREATE PROCEDURE bank(
in bk_cd_in CHAR( 4 ) ,
out bk_cd_out CHAR( 4 ) ,
out bk_nm CHAR( 40 ) ,
out brh_cd CHAR( 8 ) ,
out bak_hnm CHAR( 40 ) ,
out ur_cd CHAR(18),
out updt DATE,
out updt_flag CHAR( 1 ) ,
out brh_nm CHAR( 40 ) ,
out cty_nm CHAR( 40 ) )
SELECT bank_cd, bank_nm, branch_cd, bank_hnm, user_cd, update_dt, update_flag, branch_nm, city_nm
FROM bankmst
WHERE bank_cd = bk_cd_in
into bk_cd_out, bk_nm, brh_cd, bak_hnm, ur_cd, updt, updt_flag, brh_nm, cty_nm ;
用jsp编写的调用代码out参数是空的,在运行jsp页面时出现错误:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: '字段列表中的未知列'b1' '结束
try
{
cs = con.prepareCall("{call bank(?,?,?,?,?,?,?,?,?,?)}");
String s1 = para;
cs.setString(1,para);
cs.registerOutParameter(2, java.sql.Types.VARCHAR);
cs.registerOutParameter(3, java.sql.Types.VARCHAR);
cs.registerOutParameter(4, java.sql.Types.CHAR);
cs.registerOutParameter(5, java.sql.Types.CHAR);
cs.registerOutParameter(6, java.sql.Types.CHAR);
cs.registerOutParameter(7, java.sql.Types.DATE);
cs.registerOutParameter(8, java.sql.Types.CHAR);
cs.registerOutParameter(9, java.sql.Types.CHAR);
cs.registerOutParameter(10, java.sql.Types.CHAR);
cs.registerOutParameter(11, java.sql.Types.INTEGER);
rs = cs.executeQuery();
out.println("\nexecuted 3\n");
String b1 = cs.getString(2);
String b2 = cs.getString(3);
String b3 = cs.getString(4);
String b4 = cs.getString(5);
String b5 = cs.getString(6);
java.util.Date b6 = cs.getDate(7);
String b7 = cs.getString(8);
String b8 = cs.getString(9);
String b9 = cs.getString(10);
System.out.println(b1);
System.out.println(b2);
System.out.println(b3);
System.out.println(b4);
System.out.println(b5);
System.out.println(b6);
System.out.println(b7);
System.out.println(b8);
System.out.println(b9);
}
..我使用的是eclipse 3.6,代码是用mysql 5.1编写的