0 Replies Latest reply: Dec 14, 2010 2:51 AM by 752223 RSS

    Empty OracleDataReader

    752223
      I have stored procedure that work good. But if I try to read a value from it – I become empty OracleDataReader…


      Stored procedure:

      PROCEDURE "LOADDAY" (
      PARAM_USERID IN NUMBER,
      PARAM_MONTHNAME IN VARCHAR2,
      PARAM_DAYNUMBER IN NUMBER,

      DAYBEGIN OUT VARCHAR2) IS


      BEGIN

      SELECT DAY.BEGIN

           INTO DAYBEGIN
           
           FROM DAY
           WHERE DAY.ID = 1;
                     
           NULL;
      END;


      and

      C# Code:
      public voidLoadDay(int userID, string monthName, int dayNumber)
                {
                     OracleConnection connection = GetConnection();

                     using (connection)
                     {
                          OracleCommand oracleCommand = new OracleCommand("LOADDAY", connection);

                          oracleCommand.CommandType = System.Data.CommandType.StoredProcedure;

                          oracleCommand.Parameters.Add(new OracleParameter("PARAM_USERID", userID));
                          oracleCommand.Parameters.Add(new OracleParameter("PARAM_MONTHNAME", monthName));
                          oracleCommand.Parameters.Add(new OracleParameter("PARAM_DAYNUMBER", dayNumber));


                          OracleParameter oracleParamter = new OracleParameter("DAYBEGIN", OracleDbType.Varchar2, 20);                    
                          oracleParamter.Direction = System.Data.ParameterDirection.Output;
                          oracleCommand.Parameters.Add(oracleParamter);


                          connection.Open();

                          OracleDataReader oracleDataReader = oracleCommand.ExecuteReader();
           }

      }