none
ORA-01453: SET TRANSACTION must be first statement of transaction RRS feed

  • Question

  •  

    Hi All,

     

    I am getting an error ORA-01453:  SET TRANSACTION must be first statement of transaction. rarely

    My code is :

    Try

    ' get a connection object with the connection string set

    conn = Configurations.get_DB_Connection_Write(txtKey)

    ' open the connection

    conn.Open()

    ' begin transaction

    ts = conn.BeginTransaction(IsolationLevel.ReadCommitted)

    ' create a command object

    cmd = New OracleCommand(SQLText, conn, ts)

    ' Add the parameter objects to the command

    If (Not params Is Nothing) Then

    For i = 0 To UBound(params)

    cmd.Parameters.Add(params(i))

    Next (i)

    End If

    ' Execute the command and return the nbr of rows affected

    NbrRowsAffected = cmd.ExecuteNonQuery()

    ' commit transaction

    ts.Commit()

    ' return the nbr of rows affected

    Return NbrRowsAffected

    Catch ex As Exception

    ' Rollback the transaction

    If (Not ts Is Nothing) Then ts.Rollback()

    ' throw all exceptions

    ' throwing exception with class name, method name and exception message

    Throw ex

    Finally

    ' close the connection

    If (Not conn Is Nothing) Then conn.Close()

    End Try

     

    I dont why is this getting .....and also  this error is not consistent...... my db is oracle 9i...

    advd thanks for your help

     

    thanks

    Antoops

     

    Thursday, September 13, 2007 7:10 AM

Answers

  • hi,
    I suspect is the oracle oci.dll version. If below version 10.2 will cause this problem.
    But if you want to solve this problem without update your oci.dll.
    you just change this code
    ts=
    conn.BeginTransaction(IsolationLevel.ReadCommitted)
     to
    ts=
    conn.BeginTransaction( )

    Do not set the IsolationLevel,

    Hopes this help!~
    Friday, July 18, 2008 2:58 AM

All replies


  • We have run into the same error but intermittently. Is your code running against 9i or 8i?

    It seems to be speed related as well since in one installation the problem went away when DB logging was turned on and in another installation it went away when we had code that did some selects.

    Len
    Friday, October 19, 2007 1:36 PM
  • hi,
    I suspect is the oracle oci.dll version. If below version 10.2 will cause this problem.
    But if you want to solve this problem without update your oci.dll.
    you just change this code
    ts=
    conn.BeginTransaction(IsolationLevel.ReadCommitted)
     to
    ts=
    conn.BeginTransaction( )

    Do not set the IsolationLevel,

    Hopes this help!~
    Friday, July 18, 2008 2:58 AM
  • Sorry for late reply. It is working now by removing isolation level. thanks for your help!!
    Wednesday, November 25, 2009 6:07 AM
  • Hi Team,

    We are also facing the same issue with BeginTransaction(IsolationLevel.ReadCommitted).
    But it is happing only when we point to our test database and the same code is working fine when we point to production database. Is there any way to handle this issue without change our code i.e without removing IsolationLevel.ReadCommitted.

    Please help us in resolving this issue.

    ======================================

     

    The exception we are getting is ...

     

    ORA-01453: SET TRANSACTION must be first statement of transaction

       at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc)

       at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals)

       at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor)

       at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()

       at System.Data.OracleClient.OracleTransaction..ctor(OracleConnection connection, IsolationLevel isolationLevel)

       at System.Data.OracleClient.OracleInternalConnection.BeginOracleTransaction(IsolationLevel il)

       at System.Data.OracleClient.OracleInternalConnection.BeginTransaction(IsolationLevel il)

       at System.Data.OracleClient.OracleConnection.BeginDbTransaction(IsolationLevel isolationLevel)

       at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction(IsolationLevel isolationLevel)

       at MID.Applications.CircManagerNet.stdBILLING.FullPaymentFlowSqlEngine.GetReportData(String userInfo, String reportTemplate) in C:\MID\Applications\CircManagerNet\branches\INTF006918\Server\Source\STANDARDREPORTS\stdBILLING\FullPaymentFlow.cs:line 839


    Thank you, Regards, Srigopal
    Friday, December 30, 2011 6:57 PM
  • Removing the IsolationLevel worked for me as well. Thanks 
    Friday, August 17, 2012 9:52 AM