ORA-01453: SET TRANSACTION must be first statement

ddc

Member
We issue thousands of successful queries and then all of a sudden we get the above error randomly.

I have the following scenario. The TOracleSession.IsolationLevel = ilReadCommitted. I also issue a TOracleSession.SetTransaction(tmReadCommitted) for each transaction. I recently added a TOracleSession.Connected check before the above SetTransaction is issued. This is when the error started occurring. If I take the SetTransaction call away, the error has not resurfaced.

Why does this happen? and why not every time?
 
Oracle will implicitly start a transaction with the first delete, insert, update, select for update, lock, set transaction, or savepoint statement. Accessing a database link will also start a transaction.

Could it be that any of these statements have been executed since the last commit/rollback and before you call SetTransaction?

------------------
Marco Kalter
Allround Automations
 
I never say never. But I do not believe that is occurring. Obviously I cant prove it. I just wanted to make sure that a statement you describe is not in the ToracleSession.Connected call. If it is not, i will dig for the obscure scenario
 
You might want to use the Oracle Monitor to find out what SQL Statements have been executed since the last rollback/commit and before the SetTransaction that raises this exception.

------------------
Marco Kalter
Allround Automations
 
Back
Top