within a transaction for
(which defaults to
). The transaction is committed if the body finishes successfully (without aborting or throwing), otherwise the database is rolled back.
The following example shows how to use
to insert a new record, updates the department number of employes from 40 to 50, and removes employees whose salary is higher than 300,000. If an error occurs anywhere in the body and an
is executed, none of the updates are committed.