问题
ORA-00900: invalid SQL statement
This is the error i get when i am trying to hit a stored procedure(in Oracle) from my API.
I am using Repository pattern with Entity framework.(EF Core 2.2)
This is my call,
return FetchWithStoredProcedure("PROC_GETMYPROC",
new OracleParameter("PARAM1", OracleDbType.Int32, ParameterDirection.Input) { Value = PageNo },
new OracleParameter("PARAM2", OracleDbType.Int32,ParameterDirection.Input) { Value = PageSize },
new OracleParameter("PARAM3", OracleDbType.Varchar2, 30, ParameterDirection.Input) { Value = SearchTerm },
new OracleParameter("PARAM4", OracleDbType.Int32, ParameterDirection.InputOutput) { Value = TotalRows },
new OracleParameter("PARAM5",OracleDbType.RefCursor, ParameterDirection.Output)
).ToList();
This is my FetchWithStoreProcedure method
public IEnumerable<T> FetchWithStoredProcedure(string query, params object[] parameters)
{
return _entities.Set<T>().FromSql(query, parameters);
}
And this is the exception thrown.
回答1:
Kindly try like the below
return FetchWithStoredProcedure("BEGIN PROC_GETMYPROC(@PARAM1,@PARAM2,@PARAM3
,@PARAM4,@PARAM5); END",
来源:https://stackoverflow.com/questions/60953138/unable-to-hit-oracle-stored-proc-using-net-ef2-2-core-repository-pattern