Search code examples
c#oracleodp.nettemp-tables

ORACLE Temp table not session specific (ODP.NET)


I have a program that calls a stored procedure which uses a temp table. I notice the first time i make the call i get the right amount of data back, but every n calls the rows keep getting bigger.

I looked into the issue and came to understand that the temp table does not get cleared, so i had to manually add a delete statement at the beginning of my stored procedure.

DELETE FROM  sampleSchema.temp; --This was added AFTER i found out it doesnt clear per session
        -- put relevant data set into temp table first
INSERT INTO sampleSchema.temp (date_, por, id)

Here is my table structure and connection string for ODP.net:

-- Create table
create global temporary table sampleSchema.temp
(
  date_        NUMBER(8) not null,
  por    VARCHAR2(30) not null,
  id       VARCHAR2(12) not null
)
on commit preserve rows;

Connection string for ODP.NET:

<connectionStrings>
        <add name="EDB" connectionString="USER ID=/;MIN POOL SIZE=1;DATA SOURCE={0};CONNECTION TIMEOUT=16;MAX POOL SIZE=12" />
</connectionStrings>

Solution

  • Would the option on commit delete rows be the solution to that problem?