2 Day Developer > Using SQL > Using Transaction Control S... > Committing Transaction Changes
Committing Transaction Changes |
Previous |
Next |
The SQL COMMIT
statement saves any changes made to the database. When a COMMIT
has been issued, all the changes since the last COMMIT
, or since you logged on as the current user, are saved.
Note: If you are using SQL Commands, the Autocommit feature can be set to automatically commit changes after issuing SQL statements. |
Example: Using the SQL COMMIT Statement to Save Changes shows how to use COMMIT
to commit (save) changes to the employees
table in the database.
Using the SQL COMMIT Statement to Save Changes
-- add a row and then update the data
INSERT INTO employees (employee_id, last_name, email, hire_date, job_id, salary)
VALUES (12, 'Doe', 'john.doe', '31-AUG-05', 'SH_CLERK', 2400);
UPDATE employees SET salary = salary*1.10 WHERE employee_id = 12;
-- commit (save) the INSERT and UPDATE changes in the database
COMMIT;