locked
Oracle apps policy with C# mo_global.set_policy_context RRS feed

  • Question

  • User57289999 posted

    How to allow the policy to use Oracle Views (Applications) before report (RDLC) in Report Viewer.

    Something like this:

    SELECT AMOUNT_APPLICABLE_TO_DISCOUNT From
    AP_INVOICES_V

    I need to call this PL/SQL Before (Policy Package) Using this select statement:

    Begin
    mo_global.set_policy_context('S', 90);
    End;

    so I did this on page load before setting the SQL Data source to the report:

            if (!IsPostBack)
            {
    
                db.connectODB();
                OracleCommand ora_cmd = new OracleCommand("mo_global.set_policy_context", db.con);
                ora_cmd.BindByName = true;
                ora_cmd.CommandType = CommandType.StoredProcedure;
    
                ora_cmd.Parameters.Add("P_ACCESS_MODE", 'S');
    
                ora_cmd.Parameters.Add("P_ORG_ID", 90);
    
                ora_cmd.ExecuteNonQuery();
            }

    But still no data retrieved.

    Monday, April 14, 2014 2:47 AM

All replies

  • User724169276 posted
    ora_cmd.Parameters.AddWithValue("P_ACCESS_MODE", 'S');
    ora_cmd.Parameters.AddWithValue("P_ORG_ID", 90);

    Monday, April 14, 2014 2:53 AM
  • User57289999 posted

    There is no method called like that (AddWithValue) !!!

    ora_cmd.Parameters.AddWithValue("P_ACCESS_MODE", 'S');
    ora_cmd.Parameters.AddWithValue("P_ORG_ID", 90);

    Monday, April 14, 2014 3:07 AM
  • User724169276 posted
    ora_cmd.Parameters.Add(new OracleParameter("@P_ACCESS_MODE", "S"));
    ora_cmd.Parameters.Add(new OracleParameter("@P_ORG_ID", "90"));

    make sure the paramters names of stored procedure are same as P_ACCESS_MODE & P_ORG_ID

    Monday, April 14, 2014 3:12 AM
  • User57289999 posted
    I tried this but without '@' because it cant understand the '@' or the ':'.

    Ashim Chatterjee

    ora_cmd.Parameters.Add(new OracleParameter("@P_ACCESS_MODE", "S"));
    ora_cmd.Parameters.Add(new OracleParameter("@P_ORG_ID", "90"));

    make sure the paramters names of stored procedure are same as P_ACCESS_MODE & P_ORG_ID

    I can retrieve data only if i retrived by this sql:

    SELECT AMOUNT_APPLICABLE_TO_DISCOUNT FROM
    AP_INVOICES_ALL

    NOT

    SELECT AMOUNT_APPLICABLE_TO_DISCOUNT From
    AP_INVOICES_V

    because I have to run this procedure before the report run to allow the access to the views of oracle:

    Begin
    mo_global.set_policy_context('S', 90);
    End;

    or I have make it simpler:

    CREATE OR REPLACE PROCEDURE APPS.policy_Activate
    IS
    BEGIN
     
      MO_GLOBAL.set_policy_context('S', 90);
     
    END;
    /

    so I need to run this before the report, but it is not working:

                ODBConn db = new ODBConn();
                db.connectODB();
                OracleCommand ora_cmd = new OracleCommand("APPS.policy_Activate", db.con);
                ora_cmd.CommandType = CommandType.StoredProcedure;
    
                ora_cmd.ExecuteNonQuery();
    Monday, April 14, 2014 3:38 AM