存储过程输出参数问题 declare iflag number;begin test('OK',iflag);end;执行成功后,变量iflag中就存储了你的返回的值, 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 out参数和一般语言里面的地址传递的参数是一个道理。 call test('test',?); 写法错误。一般输出参数可以用脚本或包个语句块来测。 public String callNumberParaProcedure(String sProcSQL)throws Exception{ return callProcedureOut(sProcSQL,Types.NUMERIC); } public String callProcedureOut( String sProcSQL,int nOutDataType)throws Exception{ Connection conn = null; String sOut = ""; try{ conn = DataSourceFactory.getInstance().getConnection(DataSourceFactory.JDBC); CallableStatement callState = conn.prepareCall(sProcSQL); callState.registerOutParameter(1,nOutDataType); callState.executeQuery(); sOut = callState.getString(1); }catch (java.sql.SQLException e){ conn.close(); System.out.println(e.getMessage()); throw new Exception("执行过程"+sProcSQL+"操作失败!"); } conn.close(); return sOut.trim(); }调用语句:String SQL = "{CALL test('" + name + "',?)}"; String sCode=proc.callNumberParaProcedure(SQL);我用这样的语句块来测的呀!在sql/pl中我可申请一个变量,declare iflag number;begin test('OK',iflag);end;在程序中我怎样来实现呢?我又怎样来写SQL呢? set serveroutput on;declare iflag number;begin test('OK',iflag); dbms_output.put_line(iflag);end; 用户锁定和解锁 Oracle SQL问题distinct connect by clob? 存储过程中的异常 求助 基于oracle的论文 时间的更新怎么弄? Oracle insert 问题 重SQl_Server中导入数据到Oracle时的问题 Oracle数据库sql语句 多谢各位大虾: “监听器未能启动专用的服务器进程“问题 存储过程问题请教 关于数据库公共连接linkA的疑问?
return callProcedureOut(sProcSQL,Types.NUMERIC);
}
public String callProcedureOut( String sProcSQL,int nOutDataType)throws Exception{
Connection conn = null;
String sOut = "";
try{
conn =
DataSourceFactory.getInstance().getConnection(DataSourceFactory.JDBC);
CallableStatement callState = conn.prepareCall(sProcSQL);
callState.registerOutParameter(1,nOutDataType);
callState.executeQuery();
sOut = callState.getString(1);
}catch (java.sql.SQLException e){
conn.close();
System.out.println(e.getMessage());
throw new Exception("执行过程"+sProcSQL+"操作失败!");
}
conn.close();
return sOut.trim();
}
调用语句:
String SQL = "{CALL test('" + name + "',?)}";
String sCode=proc.callNumberParaProcedure(SQL);
我用这样的语句块来测的呀!
在sql/pl中我可申请一个变量,
declare
iflag number;
begin
test('OK',iflag);
end;
在程序中我怎样来实现呢?我又怎样来写SQL呢?
declare
iflag number;
begin
test('OK',iflag);
dbms_output.put_line(iflag);
end;