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 commit and rollback?

former_member1284402
Participant
0 Kudos

hi all,

can anybody tell me What is commit and rollback?

thanks n regards .

saurabh .

10 REPLIES 10

Former Member
0 Kudos

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.

************************************

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

In database level this will be used..

Commit is nothing but SAVE the current record..

If u rol back before commit means whatever u proceeded for the SAVING will be roll back and the data will not be stored..

This will be used,When some times u r filling a register form..after filling 20 fields,In the 21st field u will not to registrer means it will be rollbacked using the Rollbeck command

Reward if useful

matt
Active Contributor
0 Kudos

It's similar to when you're using Word or Excel. You can make and undo changes. But they're not on the file, until you SAVE. Similarly you can make and undo lots of changes, and then quit without saving - a bit like rollback.

When you make changes to data in a database, the change you make are recorded, but are not reflected in the database. When you commit, the recorded changes are written to the database. If you start to make changes, then change your mind, you can rollback the changes, removing the record of your changes, and leaving the database unchanged.

matt

Former Member
0 Kudos

Hi,

Commit - it saves whatever changes you have done .

Rollback - its reverse the changes done.

Regards,

Vani

Former Member
0 Kudos

Hi

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.

0 Kudos

Do you and Vasu G share the same answer database?!

Former Member
0 Kudos

Hi,

Commit is noething but save

Rollback behaves like control+z ( undo ) in ms office etc...

Plz Rewards,

Mahi.

Former Member
0 Kudos

Hi Saurabh,

COMMIT & ROLLBACk are used at Database levels.

<b>COMMIT</b> : Its nothing but saving the changes made to the Database from the last COMMIT statement usage.

<b>ROLLBACK</b> : When you don't want to save the changes made from the last usage of COMMIT statement, then use ROLLBACK(ROLLBACK means reverse the changes made to database).

Former Member
0 Kudos

While sitting in the ABAP Editor, type the keywords COMMIT and ROLLBACK. You next then ROLLBACK your sleeves and COMMIT to hit the F1 Function Key to learn what these commands mean and how to use them. = )

Former Member
0 Kudos

HAI,

ITS LIKE A ORDER.

THINK IF U R CHECKING SOMETHING IN A IF CONDITION, THE IF CONDITOION IS WITHIN A LOOP.IF THE "IF" CONDITION IS SATISFIED, IT WILL PERFORM THE NECESSARY LOGIC WITHIN THAT IF CONDITION AND THE RESULT WILL BE STORED IN A MEMORY. THIS IS WT "COMMIT" STATEMENT DO.

IN CASE OF "ROLLBACK", IF THE "IF" CONDITION IS NOT SATISFIED, IT WONT GOTO THE NEXT STEP(PROCESSING LOGIC). IT WILL GO BACK TO THE BEGINING OF THE LOOP AND PICK THE NEXT RECORD FOR THE PROCESSING(IF CONDITION). OK.THIS IS WT "ROLLBACK" DO.

I THINK UR DOUBT WILL BE CLEAR.

REGARDS,

SAFIQ