I've got a fairly large and complex Oracle stored procedure (~2200 lines) which I'm able to call successfully from SQL Developer, and executes in 2-3 seconds, using the following:
var o_my_data refcursor
begin
SCHEMA.pkg.get_data(i_p1 => 'val1',
i_p2 => 'p2',
i_p3 => 0,
i_p4 => 100000,
o_my_data => :o_my_data);
end;
/
print o_my_data
However, when I call this from ODP.NET, it throws the following exception:
unable to extend temp segment by 128 in tablespace TEMP1
The way the stored procedure is being called is fairly straightforward:
using (var connection = new OracleConnection(connectionString))
{
using (var command = connection.CreateCommand())
{
connection.Open();
command.CommandText = "SCHEMA.pkg.get_data";
command.CommandType = CommandType.StoredProcedure;
command.BindByName = true;
command.Parameters.Add("i_p1", "val1");
command.Parameters.Add("i_p2", "p2");
command.Parameters.Add("i_p3", 0);
command.Parameters.Add("i_p4", 1000000);
command.Parameters.Add("o_my_data", OracleDbType.RefCursor, ParameterDirection.Output);
// Fails here, before the result can even be read from the output parameter
command.ExecuteNonQuery();
connection.Close();
}
}
When called from ODP.NET, it seems like the temp space gets used up very quickly, hits the 5gb limit, and then throws the exception above where it can't increase the space.
However, if it's an issue with the stored procedure, why can it be executed successfully from SQL Developer with no errors (and memory usage is significantly lower) ?