存储过程 :
贴代码:
public int PauseAccount(string account)
{
int iResult=456;
try
{
OracleParameter[] paramList=new OracleParameter[2]; paramList[0]=new OracleParameter("p_UserName",OracleType.VarChar);
paramList[1]=new OracleParameter("p_Rtcode",OracleType.Number);
paramList[0].Value=account;
paramList[1].Direction=ParameterDirection.Output; bool bIsSusc=daCon.ExecuteProcedure("ICS_User_Pause",paramList);

if(bIsSusc)
{
iResult=Convert.ToInt32(paramList[4].Value.ToString());
}

}
catch(Exception ex)
{
Tools.WriteLog("ICS UserPortal",ex,System.Diagnostics.EventLogEntryType.Error);
}
return iResult;
}调用代码:int iResult=aa.PauseAccount("0594811113");

解决方案 »

  1.   

    create or replace procedure ICS_User_Pause
    (
       p_UserName in varchar,   --父帐号
       p_RetCode  out number -- 返回码:0=成功 非0=错误码
    )
       /* p_RetCode 返回码定义
        20 参数不合法
        40 找不到父帐号
        50 更新业务订购表历史记录表和服务订购历史记录表失败
       */
    is
       v_userid number(10);
       v_tranid  number(10);
       CURSOR cur_srv_sub IS select transactionId from user_srv_subscription where userid = v_userid;
    begin
        ....
    end ICS_User_Pause;
      

  2.   

    在java里面调用存储过程.我可以给你看一个例子.
    因为你的程序里面有封装.所以别人很难看出你的后台的类是否有问题的.
      /**
       * 调用存储过程p_dtsgfztj_getsql
       * sql功能描述: 返回报表表体
       * @param  startDate 开始日期
       * @param  endDate 结束日期
       * @return  result sql语句:
       * @throws DAOException 数据访问异常
       */
      private static String getContent(String startDate, String endDate) throws
          DAOException {
        DBconn db = null;
        String sql = null;
        ResultSet rs = null;
        Connection con = null;
        CallableStatement call = null;
        try {
          db = new DBconn();
          con = db.getConnection();
          call = con.prepareCall("call p_dtsgdttj_getsql(?,?,?)");
          call.registerOutParameter(3, java.sql.Types.VARCHAR);
          call.setString(1, startDate);
          call.setString(2, endDate);
          rs = call.executeQuery();
          sql = call.getString(3);
        }
        catch (ConnectionException e) {
          throw new DAOException(e, "统计报表失败!");
        }
        catch (SQLException e) {
          throw new DAOException(e);
        }
        finally {
          if (rs != null) {
            try {
              rs.close(); //关闭结果集
            }
            catch (Exception e) {
              e.printStackTrace();
            }
          }
          if (call != null) {
            try {
              call.close();
            }
            catch (Exception e) {
              e.printStackTrace();
            }
          }
          if (con != null) {
            try {
              con.close(); //关闭连接
            }
            catch (Exception e) {
              e.printStackTrace();
            }
          }
        }
        return sql;
      }
      

  3.   

    这个更为详细点:  /**
       * 调用存储过程p_dtsgdttj_getsql_top:
       * 返回获得表头的sql语句
       * sql功能描述: 返回数组列数
       * @param  startDate 开始日期
       * @param  endDate 结束日期
       * @return  int 数组列数
       *
       * @throws DAOException 数据访问异常
       */
      private static int getCol(String startDate,
                         String endDate) throws DAOException {
        DBconn db = null;
        int col = 0;
        ResultSet rs = null;
        Connection con = null;
        CallableStatement call = null;
        try {
          db = new DBconn();
          con = db.getConnection();
          call = con.prepareCall("{call p_dtsgdttj_getsql_top(?,?,?,?)}"); //调用存储过程
          call.registerOutParameter(3, java.sql.Types.VARCHAR); //登记输出参数为字符串(out)
          call.registerOutParameter(4, java.sql.Types.INTEGER); //登记输出参数为数字(out)      call.setString(1, startDate); //为in参数赋值
          call.setString(2, endDate); //为in参数赋值
          rs = call.executeQuery(); //置入结果集中
          col = call.getInt(4); //
        }
        catch (ConnectionException e) {
          throw new DAOException(e, "统计报表失败!");
        }
        catch (SQLException e) {
          throw new DAOException(e);
        }// 关闭数据库资源
        finally {
          if (rs != null) {
            try {
              rs.close(); //关闭结果集
            }
            catch (Exception e) {
              e.printStackTrace();
            }
          }
          if (call != null) {
            try {
              call.close();
            }
            catch (Exception e) {
              e.printStackTrace();
            }
          }      if (con != null) {
            try {
              con.close(); //关闭连接
            }
            catch (Exception e) {
              e.printStackTrace();
            }
          }
        }
        return col;
      }
      

  4.   

    paramList[1]=new OracleParameter("p_Rtcode",OracleType.Number);把Number改为Integer试试?