sql >> Database teknologi >  >> RDS >> Oracle

opdatering af oracle-erklæringen virker ikke

Du bør bruge denne struktur til at administrere transaktioner med Oracle (se MSDN-dokumenter ) :

Public Sub RunOracleTransaction(ByVal connectionString As String)
    Using connection As New OracleConnection(connectionString)
        connection.Open()

        Dim command As OracleCommand = connection.CreateCommand()
        Dim transaction As OracleTransaction

        ' Start a local transaction
        transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted)
        ' Assign transaction object for a pending local transaction
        command.Transaction = transaction

        Try
            command.CommandText = _
                "INSERT INTO Dept (DeptNo, Dname, Loc) values (50, 'TECHNOLOGY', 'DENVER')"
            command.ExecuteNonQuery()
            command.CommandText = _
                "INSERT INTO Dept (DeptNo, Dname, Loc) values (60, 'ENGINEERING', 'KANSAS CITY')"
            command.ExecuteNonQuery()
            transaction.Commit()
            Console.WriteLine("Both records are written to database.")
        Catch e As Exception
            transaction.Rollback()
            Console.WriteLine(e.ToString())
            Console.WriteLine("Neither record was written to database.")
        End Try
    End Using
End Sub


  1. Sådan erklærer du en markør efter startsektionen af ​​en Oracle PL/SQL-procedure

  2. Rydder ud i et felt med telefonnumre i mySql

  3. Hjælp til at beregne kompleks sum i hierarkisk datasæt

  4. Kan en lagret procedure/funktion returnere en tabel?