Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

What is Rollback,Commit

Former Member
0 Kudos

Hi friends...What is Rollback,Commit..!!

Thanks&regards

5 REPLIES 5

Former Member
0 Kudos

Commit :-Saves changes made to DB

Rollback:- donot Save the changes made to DB

Thanks,

Praveena

Former Member
0 Kudos

From the point of view of database programming, a database LUW is an inseparable sequence of database operations that ends with a database commit. The database LUW is either fully executed by the database system or not at all. Once a database LUW has been successfully executed, the database will be in a consistent state. If an error occurs within a database LUW, all of the database changes since the beginning of the database LUW are reversed. This leaves the database in the state it was in before the transaction started.

the statements

COMMIT WORK.

and

ROLLBACK WORK.

for confirming or undoing database updates. COMMIT WORK always concludes a database LUW and starts a new one. ROLLBACK WORK always undoes all changes back to the start of the database LUW.

Former Member
0 Kudos

Hi Rajesh,

During a program execution, when you change the database, that new data is not immediately written to the database..

When we use COMMIT WORK, it updates the database.. if it is successfull the sy-subrc value is 0.. if it fails we use ROLL-BACK.

ROLLBACK reverts back everything.. means all database changes that were tried in the last commit.

Thanks and Best Regards,

Vikas Bittera.

Former Member
0 Kudos

hi

good

ROLLBACK->

In a ROLLBACK, all the changes made by a transaction or a subtransaction on the database instance are reversed.

· Changes closed with a COMMIT can no longer be reversed with a ROLLBACK.

· As a result of a ROLLBACK, a new transaction is implicitly opened.

In normal database operation, the database system performs the required ROLLBACK actions independently. However, ROLLBACK can also be explicitly requested using appropriate SQL statements.

In a restart, the system checks which transactions were canceled or closed with a ROLLBACK. The actions are these transactions are undone.

COMMIT->

In a COMMIT, all the changes made by a transaction or a subtransaction on the database instance are recorded.

· Changes closed with a COMMIT can no longer be reversed with a ROLLBACK.

· As a result of a COMMIT, a new transaction is implicitly opened.

In normal database operation, the database system performs the required COMMIT actions independently. However, COMMIT can also be explicitly requested using appropriate SQL statements.

In a restart, the system checks which transactions were closed with a COMMIT. These actions are redone. Transactions not yet closed with a COMMIT are undone.

THANKS

mrutyun^

Former Member
0 Kudos

hi,

In the database when we are doign transactions that intermideate changes are store into the LOGS and also done in the databse.

Now when we do commit that logs are stored to the database permanantly.

and if we do the Rollback that intermediate changes which are stored into the

LOGS are undone by reverse transaction according to the LOGS.

We can do the partial rollback also by using savepoint.