Was this helpful?
SAVEPOINT Example
The following example declares savepoints among other SQL statements:
EXEC SQL INSERT INTO emp (name, sal, bdate)
        VALUES ('Jones,Bill', 10000, 1945);
/*set first savepoint marker */
EXEC SQL SAVEPOINT setone;
EXEC SQL INSERT INTO emp (name, sal, bdate)
        VALUES ('Smith,Stan', 20000, 1948);
/* set second savepoint marker */
EXEC SQL SAVEPOINT 2;
EXEC SQL INSERT INTO emp (name, sal, bdate)
        VALUES ('Engel,Harry', 18000, 1954);
/* undo third append; first and second remain */
EXEC SQL ROLLBACK TO 2;
/* undoes second append; first remains */
EXEC SQL ROLLBACK TO setone;
EXEC SQL COMMIT;
/* only the first append is committed */
Last modified date: 08/29/2024