我在oracle 11g中有一个包如下:
CREATE OR REPLACE PACKAGE "HRS.PKG_TRAINING_SP" as
TYPE T_CURSOR IS REF CURSOR;
procedure GETPERSONNELTRAINIGLIST(
personnel_Id_in in string,
base_date_in in string,
is_current_in in number,
lst OUT T_CURSOR );
end;
如何使用Entity Framework(代码优先)执行上述过程包(GETPERSONNELTRAINIGLIST
)?
注意:我正在使用Entity Framwork 6.0(代码优先)并为Oracle开发EF Provider
。
更新 我使用以下代码:
var param1 = new OracleParameter("personnel_Id_in", OracleDbType.VarChar, "c5eb5589-8fee-47b6-85ad-261a0307cc16", ParameterDirection.Input);
var param2 = new OracleParameter("base_date_in", OracleDbType.VarChar, "1112", ParameterDirection.Input);
var param3 = new OracleParameter("is_current_in", OracleDbType.Number, 1, ParameterDirection.Input);
var ATests =
db.Database.SqlQuery<ATest>(
"BEGIN PKG_TRAINING_SP.GETPERSONNELTRAINIGLIST(:personnel_Id_in, :base_date_in, :is_current_in); end;",
param1, param2, param3).ToList();
但低于错误:
{"ORA-06550: line 1, column 7:\nPLS-00306: wrong number or types of arguments in call to 'GETPERSONNELTRAINIGLIST'\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored"}
答案 0 :(得分:16)
请按以下方式重写您的代码:
var param1 = new OracleParameter("personnel_Id_in", OracleDbType.VarChar, "c5eb5589-8fee-47b6-85ad-261a0307cc16", ParameterDirection.Input);
var param2 = new OracleParameter("base_date_in", OracleDbType.VarChar, "1112", ParameterDirection.Input);
var param3 = new OracleParameter("is_current_in", OracleDbType.Number, 1, ParameterDirection.Input);
var param4 = new OracleParameter("result", OracleDbType.Cursor, ParameterDirection.Output);
var ATests =
db.Database.SqlQuery<ATest>(
"BEGIN PKG_TRAINING_SP.GETPERSONNELTRAINIGLIST(:personnel_Id_in, :base_date_in, :is_current_in, :result); end;",
param1, param2, param3, param4).ToList();
与您联系
答案 1 :(得分:0)