SET SERVEROUTPUT ON;

CREATE TABLE transactions
( id    NUMBER(10) PRIMARY KEY,
  text  VARCHAR2(32)
);

SELECT * FROM transactions;
------------------------------------------------------------------------------------------------------------------------

INSERT INTO transactions VALUES (1,'Pas de savepoint');
-- 1 ligne creee.
INSERT INTO transactions VALUES (2,'Savepoint A');
-- 1 ligne creee.
SAVEPOINT A;
-- Savepoint cree.

INSERT INTO transactions VALUES (3,'Savepoint B');
-- 1 ligne creee.
SAVEPOINT B;
-- Savepoint cree.

INSERT INTO transactions VALUES (4,'Pas de savepoint');
-- 1 ligne creee.

SELECT * FROM transactions;
------------------------------------------------------------------------------------------------------------------------

ROLLBACK TO SAVEPOINT B;
-- Annulation (rollback) effectuee.
SELECT * FROM transactions;

ROLLBACK TO SAVEPOINT A;
--Annulation (rollback) effectuee.
SELECT * FROM transactions;

COMMIT COMMENT 'commentaire de validation' ;
-- Validation effectuee.
SELECT * FROM transactions;

------------------------------------------------------------------------------------------------------------------------










