Se ottieni questa exception durante l'uso di una transazione su Oracle:

System.Data.OracleClient.OracleException was caught Message=ORA-01453: SET TRANSACTION deve essere la prima istruzione della transazione

Source=System.Data.OracleClient
ErrorCode=-2146232008
Code=1453
StackTrace:
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.OracleClient.OracleConnection.BeginTransaction(IsolationLevel il)
at Penny.CrossMarketing.Manager.CrossMarketingInsertMulti(String codeVendor, List`1 items)
InnerException:
usando un codice C# tipo:

C#

using (OracleConnection cnn = GetOracleConnection())
{
  cnn.Open();
  trn = cnn.BeginTransaction(IsolationLevel.ReadCommitted);
  ...
}
sostituisci

C#

trn = cnn.BeginTransaction(IsolationLevel.ReadCommitted);
con

C#

trn = cnn.BeginTransaction();
Tags:
C#236 Database75 Errori120 Oracle24 PL/SQL16
Potrebbe interessarti anche: