Import procedure from oracle package using Entity Framework 5

CREATE OR REPLACE PACKAGE johns_test_pkg AS

  PROCEDURE test(some_parameter IN  NUMBER,
                 success_id     OUT NUMBER);

  PROCEDURE test_no_out_parameter(some_parameter IN NUMBER);

  PROCEDURE test_no_in_parameter(success_id OUT NUMBER);

END johns_test_pkg;
/

CREATE OR REPLACE PACKAGE BODY johns_test_pkg AS

  --
  PROCEDURE test(some_parameter IN  NUMBER,
                 success_id     OUT NUMBER)
  IS
    v_app_user_session_id INTEGER;
    BEGIN
      v_app_user_session_id := 1 + some_parameter;

      success_id := v_app_user_session_id;
    END;

  --
  PROCEDURE test_no_out_parameter(some_parameter IN NUMBER)
  IS
    v_app_user_session_id INTEGER;
    BEGIN
      v_app_user_session_id := 1 + some_parameter;
    END;

  --
  PROCEDURE test_no_in_parameter(success_id OUT NUMBER)
  IS    
    v_app_user_session_id INTEGER;
    BEGIN
      v_app_user_session_id := 1 + 10;
      success_id := v_app_user_session_id;
    END;

END johns_test_pkg;
/

Given the above simple Oracle package with three procedures inside. I tried adding these procedures to my model using Entity Framework 5 to no avail. I was able to add several Oracle procedures that are not included in packages.

I read about it, and some other questions are similar to how-to-call-oracle-function-with-return-value-using-linq-to-entities and read on from the selected answer. The person claims that the parameters IN OUTor OUTshould work, but none of my three have been imported. I would suggest that the procedure test_no_in_parameterwill be loaded?

Can I load a procedure under a package?

+4
2

edmx " ", Un-tick " ", . ( ) " " "Model.Store\ /" (). " ".

, un-ticking , .

+10

EF 5 Oracle, .

  • :

    var param1 = new OracleParameter("p_param_in", OracleDbType.Number, 123,  ParameterDirection.Input);
    var param2 = new OracleParameter("p_param_out", OracleDbType.Number, ParameterDirection.Output);
    
    var param2_val = db.Database.SqlQuery<YourTestEntity>(
                   "BEGIN johns_test_pkg.test(:p_param_in, :p_param_out); END;" 
                   , param1).Single();
    
  • . , EF ( ). , , , Oracle 30 .

    CREATE OR REPLACE my_wrap_prefix__test(some_parameter IN  NUMBER,
                                           success_id     OUT NUMBER)
    IS BEGIN
        johns_test_pkg.test(some_parameter, success_id);
    END;
    
+1

Source: https://habr.com/ru/post/1541406/


All Articles