当前位置: 技术问答>java相关
Java怎么调用存储过程?给个例子吧?
来源: 互联网 发布时间:2015-03-06
本文导语: | CallableStatement cstmt = null; String sqlStr = "begin FunctionName( :1, :2,:3,:4, :5,:6 );end;"; cstmt = con.prepareCall(sqlStr); cstmt.setInt(1,12); cstmt.setInt(2,4); cstmt.registerOutParameter(3,java.sql.Types.INTEGER); cstmt.registerOutParameter(4,java.sql.T...
|
CallableStatement cstmt = null;
String sqlStr = "begin FunctionName( :1, :2,:3,:4, :5,:6 );end;";
cstmt = con.prepareCall(sqlStr);
cstmt.setInt(1,12);
cstmt.setInt(2,4);
cstmt.registerOutParameter(3,java.sql.Types.INTEGER);
cstmt.registerOutParameter(4,java.sql.Types.INTEGER);
cstmt.registerOutParameter(5,java.sql.Types.INTEGER);
cstmt.registerOutParameter(6,java.sql.Types.INTEGER);
cstmt.execute();
int a = cstmt.getInt(3);
int b = cstmt.getInt(4);
int a = cstmt.getInt(5);
int d = cstmt.getInt(6);
查一下帮助吧
String sqlStr = "begin FunctionName( :1, :2,:3,:4, :5,:6 );end;";
cstmt = con.prepareCall(sqlStr);
cstmt.setInt(1,12);
cstmt.setInt(2,4);
cstmt.registerOutParameter(3,java.sql.Types.INTEGER);
cstmt.registerOutParameter(4,java.sql.Types.INTEGER);
cstmt.registerOutParameter(5,java.sql.Types.INTEGER);
cstmt.registerOutParameter(6,java.sql.Types.INTEGER);
cstmt.execute();
int a = cstmt.getInt(3);
int b = cstmt.getInt(4);
int a = cstmt.getInt(5);
int d = cstmt.getInt(6);
查一下帮助吧
|
conn.prepareCall("your procedure");