locked
Getting Ref cursors from Oracle Procedure in Data access application Blocks RRS feed

  • Question

  • User1569769560 posted

    Hi,

         I am using the Enterprise Library 2007 and my back end is Oracle. My Oracle Procedure is returning Ref cursor like the below

    PROCEDURE Select_T_District(IDistrict_ID char,District_Cursor OUT Sys_RefCursor)
     IS
        BEGIN
              OPEN District_Cursor
              FOR
              SELECT *
              FROM T_District WHERE District_ID=IDistrict_ID;

    Now in C#.NET I am calling the procedure by using Data access application Block (DAAB)

    Database db = DatabaseFactory.CreateDatabase("DBConnection");

    // DbCommand cmd = db.GetSqlStringCommand("Select * from SOF.T_District");

    DbCommand cmd = db.GetStoredProcCommand("Select_TDistrict");

    db.AddOutParameter(cmd,dbType. )

    dbType doesnot have the Cursor type.

    How to call Ref cursor from DAAB.

    Thanks in advance.

    Tuesday, June 5, 2007 2:17 PM

All replies

  • User1586650908 posted

    Hi,

    I have tried the below snippet, still its not working . can any one help?

    {

    dbDatabase =
    DatabaseFactory.CreateDatabase();

    dbCon = dbDatabase.CreateConnection();

    dbCon.Open();

    dbTran = dbCon.BeginTransaction();

     

    dbCommand = dbDatabase.GetStoredProcCommand(
    "TMP_USER.GET_ALL_USER");

     

     

    OracleParameter prUserDetails = new OracleParameter("CUR_USERS_DETAILS", OracleType.Cursor, 2000);prUserDetails.Direction = ParameterDirection.Output;

    dbCommand.Parameters.Add(prUserDetails);

    dbDatabase.

    dbDatabase.ExecuteNonQuery(dbCommand, dbTran);

    ordUsers = (
    OracleDataReader)dbDatabase.GetParameterValue(dbCommand, "CUR_USERS_DETAILS");

     

    dbTran.Commit();

    }

    Friday, June 20, 2008 10:36 AM