Nested Transaction
Example:
begin tran
change 1
begin tran
change 2
commit tran
commit tran
In above pseudocode, there are two nested begin tran statement. Despite, the fact that it appears that there are two transactions (one inside another), there is actually only one open transaction. Thus, the transaction is active until the second commit tran statement is executed.
Example:
begin tran
change 1
begin tran
change 2
begin tran
change 3
commit tran
change 4
commit tran
change 5
rollback tran
In this example, none of the five changes would remain in the data after the rollback; again, although it looks like there are three levels of nesting, and it looks like changes 2,3,4, and 5 are fully bounded by begin/commit pairs, there is really only one transaction, and all work must complete in full or not at all. In fact, the transaction shown above is functionally identical to:
begin tran
change 1
change 2
change 3
change 4
change 5
rollback tran
Check the Sybase Wiki @ sybasewiki.com
Anurag has more than 6+ years of experience in Sybase Database Development .His Area of expertise includes Performance, Query Optimization, Cost Optimization, TSQL Development. He is also involved in Consultancy to Financial Firms for Database Implementation and Maintenance. He has supported many Global Financial firms.