Easily find issues by searching: #<Issue ID>
Example: #1832
Easily find members by searching in: <username>, <first name> and <last name>.
Example: Search smith, will return results smith and adamsmith
Aqua Data Studio / nhilam |
Follow
829
|
Description
Marks the ending point of a user-defined transaction.
Syntax
commit [tran | transaction | work] [transaction_name]
Parameters
tran | transaction | work
specifies that you want to commit the transaction or the work. If you specify
tran, transaction, or work, you can also specify the transaction_name.
transaction_name
is the name assigned to the transaction. It must conform to the rules for
identifiers. Use transaction names only on the outermost pair of nested begin
transaction/commit or begin transaction/rollback statements.
Examples
After updating the royaltyper entries for the two authors, insert the savepoint
percentchanged, then determine how a 10 percent increase in the book’s price
would affect the authors’ royalty earnings. The transaction is rolled back to the
savepoint with the rollback transaction command:
begin transaction royalty_change
update titleauthor
set royaltyper = 65 from titleauthor, titles
where royaltyper = 75
and titleauthor.title_id = titles.title_id
and title = "The Gourmet Microwave"
update titleauthor
set royaltyper = 35 from titleauthor, titles
where royaltyper = 25
and titleauthor.title_id = titles.title_id
and title = "The Gourmet Microwave"
save transaction percentchanged
update titles
set price = price * 1.1
where title = "The Gourmet Microwave"
select (price * total_sales) * royaltyper
from titles, titleauthor
where title = "The Gourmet Microwave"
and titles.title_id = titleauthor.title_id
rollback transaction percentchanged
commit transaction
Usage
• Define a transaction by enclosing SQL statements and/or system
procedures with the phrases begin transaction and commit. If you set the
chained transaction mode, Adaptive Server implicitly invokes a begin
transaction before the following statements: delete, insert, open, fetch,
select, and update. You must still explicitly enclose the transaction with a
commit.
• To cancel all or part of an entire transaction, use the rollback command.
The rollback command must appear within a transaction. You cannot roll
back a transaction after the commit has been entered.
• If no transaction is currently active, the commit or rollback statement has
no effect on Adaptive Server.
About AquaClusters Privacy Policy Support Version - 19.0.2-4 AquaFold, Inc Copyright © 2007-2017