Oracle
 sql >> Teknologi Basis Data >  >> RDS >> Oracle

Kembalikan perubahan basis data menggunakan savepoint implisit? - Oracle

Anda dapat menggunakan SAVEPOINT seperti yang dijelaskan di Cara COMMIT, ROLLBACK Transaksi Oracle .

Berikut cuplikan SAVEPOINT darinya...

SAVEPOINT

Specify a point in a transaction to which later you can roll back.

Example

insert into emp (empno,ename,sal) values (109,’Sami’,3000);
savepoint a;
insert into dept values (10,’Sales’,’Hyd’);
savepoint b;
insert into salgrade values (‘III’,9000,12000);

Now if you give

rollback to a;

Then  row from salgrade table and dept will be roll backed. Now you can commit the row inserted into emp table or rollback the transaction.

If you give

rollback to b;

Then row inserted into salgrade table will be roll backed. Now you can commit the row inserted into dept table and emp table or rollback to savepoint a or completely roll backed the transaction.

If you give

rollback;

Then the whole transactions is roll backed.

If you give

commit;

Then the whole transaction is committed and all savepoints are removed.


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Setel batas waktu koneksi database Oracle 10g di Java

  2. Oracle SQL mengelompokkan berdasarkan kolom dengan jumlah tetapi hanya jika kolomnya nol atau 0

  3. Fungsi TO_CHAR(datetime) di Oracle

  4. Bagaimana cara ZIP File di PL/SQL?

  5. Oracle varchar ke nomor