I am calling Oracle stored procedures that return RefCursors in my C # application. An example of a stored procedure is given below.
CREATE OR REPLACE
PROCEDURE "DOSOMETHING"(
P_RECORDS OUT SYS_REFCURSOR)
AS
BEGIN
OPEN P_RECORDS FOR
SELECT SOMETHING FROM SOMETABLE;
END;
When used OracleDataReaderto read the results for this, each time a procedure is called, the database analyzes the procedure. After quite a lot of searching, I found out that eliminating this call parsing is not possible when using .NET when using RefCursor.
However, if I simply call the procedure using a prepared statement, as shown below, this parsing call can be avoided.
public void DoSomething()
{
var command = ServerDataConnection.CreateCommand();
command.CommandType = CommandType.Text;
command.CommandText = "SELECT SOMETHING FROM SOMETABLE";
command.Prepare();
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
DoSomethingToResult();
}
}
}
: ? ?
, select . , .