declare 
    iflag number;
begin
    test('OK',iflag);
end;
执行成功后,变量iflag中就存储了你的返回的值,

解决方案 »

  1.   

    out参数和一般语言里面的地址传递的参数是一个道理。
      

  2.   

    call test('test',?); 写法错误。一般输出参数可以用脚本或包个语句块来测。
      

  3.   

    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呢?
      

  4.   

    set serveroutput on;
    declare 
        iflag number;
    begin
        test('OK',iflag);
        dbms_output.put_line(iflag);
    end;