ORA-01453: SET TRANSACTION deve essere la prima istruzione della transazione (Oracle)
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:
sostituisci
con
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:
C#
using (OracleConnection cnn = GetOracleConnection())
{
cnn.Open();
trn = cnn.BeginTransaction(IsolationLevel.ReadCommitted);
...
}
C#
trn = cnn.BeginTransaction(IsolationLevel.ReadCommitted);
C#
trn = cnn.BeginTransaction();