I am looking to implement Oracle Global Temporary Tables (GTT) for an existing application using dotConnect for Oracle product (v6.30). The GTT is setup to be transaction based versus session based.
I have proved the concept of writing a value to the GTT via a Store Procedure, updating a table (test_table), and using an update trigger on the table (test_table) to retrieve the value placed on the GTT by the Store Procedure. Of course, issuing a commit deletes the row from the GTT. So, conceptually everything works as expected.
When using the Entity Framework to perform the same actions in code:
Entities.RunStoreProcedure(“my_value”)
// Do some stuff
Entities.SaveChanges
Upon executing an Entities.SaveChanges(), I get the following execption: {"Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries."}
Is this fundamentally not possible using the EF or am I using the wrong approach in trying to implement the use of GTT with Entity Framework?
Thanks in advance.
Working with Oracle Global Temporary Tables
Re: Working with Oracle Global Temporary Tables
Just a quick update...
I modified the code to the following and that appears to work as expected:
Entities.Connection.Open
Trans = Entities.Connection.BeginTransaction
Entities.RunStoreProcedure(“my_value”)
// Do some stuff
Entities.SaveChanges
beginTransaction.commit
By tying everything together within the context of a transaction, the write to the GTT, and retrieving the value, worked as expected.
I modified the code to the following and that appears to work as expected:
Entities.Connection.Open
Trans = Entities.Connection.BeginTransaction
Entities.RunStoreProcedure(“my_value”)
// Do some stuff
Entities.SaveChanges
beginTransaction.commit
By tying everything together within the context of a transaction, the write to the GTT, and retrieving the value, worked as expected.
Re: Working with Oracle Global Temporary Tables
Thank you for your feedback. If you have any questions, please contact us.