Transaction Control

by

in

Explanation: Transactions are sequences of operations performed as a single logical unit of work.

  • Why It Matters: Using COMMIT and ROLLBACK ensures data integrity. Commits save changes, while rollbacks revert to the last commit if an error occurs.
  • Example:
BEGIN
    UPDATE employees SET salary = salary * 1.1 WHERE employee_id = 1;
    COMMIT;
EXCEPTION
    WHEN OTHERS THEN
        ROLLBACK;
END;

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *