Rollback Statement

Performs a SQL rollback command inside a transaction. The rollback statement rolls back all work done since the last SQL commit command for all cursors that the transaction has connected to the database.

Depending on the capabilities of your DBMS, result sets may be destroyed after rollbacks and subsequent execution of a fetch statement without reselecting will cause an error.

Syntax

Stat = "rollback".

Example

dclrand
rArtNo: RndUniN(1..1000);
var
v_artno, v_stock, v_quantity: number;
dcltrans
transaction TMain
begin
v_artno := rArtNo;
c1: SelArticle();
if v_stock = 0 then
c2: InsOrder();
end;
rollback;
end TMain;
dclsql
SelArticle:
SELECT stock,quantity
INTO :v_stock, :v_quantity
FROM article
WHERE articlenumber = :v_artno;
InsOrder:
INSERT INTO order(articlenumber, quantity)
VALUES(:v_artno, :v_quantity);