日期:2014-05-18  浏览次数:20753 次

java类中引用存储过程的问题
我在Oracle里面这样定义了一个存储过程:
    CREATE   OR   REPLACE   Procedure   insstandard(

          p_stdno   IN   ordersub.standno%type,
          v_intTotale   OUT   int,
          v_intViewNumber   OUT   int,
          v_intPrintNumber   OUT   int,
          v_intDownNumber   OUT   int,
          p_ret   OUT   varchar(20))

Begin
          select   sum(mount)   into   v_intTotale   from   ordersub   o   where   o.standno   = 'p_stdno '     AND   status= '1 ';
          select   sum(mount)   into   v_intViewNumber   from   ordersub   o   where   o.standno   = 'p_stdno '     AND   mediumtype= '0 '   AND   status= '1 ';
          select   sum(mount)   into   v_intPrintNumber   from   ordersub   o   where   o.standno   = 'p_stdno '     AND   mediumtype= '1 '   AND   status= '1 ';
          select   sum(mount)   into   v_intDownNumber   from   ordersub   o   where   o.standno   = 'p_stdno '     AND   mediumtype= '2 '   AND   status= '1 ';
          COMMIT;
          p_ret:=   ‘Sucess!’;

Exception
          when   others   then
                    ROLLBACK;
                    p_ret   :=   ‘fail’;
End;

在JAVA中我这样去调用它:
      public   int[]   getPreRs(String   standNo)   throws   Exception   {
int[]   arrInt   =   new   int[4];
CallableStatement   cstmt   =   conn.prepareCall( "{call   insstandard(?,?,?,?,?)} ");
cstmt.setString(1,standNo);
cstmt.registerOutParameter(2,Types.INTEGER);
cstmt.registerOutParameter(3,Types.INTEGER);
cstmt.registerOutParameter(4,Types.INTEGER);
cstmt.registerOutParameter(5,Types.INTEGER);
                cstmt.execute();
arrInt[0]   =   cstmt.getInt(2);
arrInt[1]   =   cstmt.getInt(3);
arrInt[2]   =   cstmt.getInt(4);
arrInt[3]   =   cstmt.getInt(5);
               
return   arrInt;
}

出现错误:对象   GB_STD.INSSTANDARD   无效    
有谁知道该怎么改啊

------解决方案--------------------
我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html
------解决方案--------------------
存储过程没有找到,你检查一下INSSTANDARD是不是定义在GB_STDshema下?