Rajesh Karunakaran
Programmer
Dear Team!
I see there are many discussions on BEGIN TRAN.... END TRAN...
However, I have a straight query which may sound weird.
Is an "END TRANSACTION" necessary in a BEGIN TRANSACTION...END TRANSACTION routine?
When we use ROLLBACK to reverse the changes, is there a need to mention END TRANSACTION at the end?
To be more clearer, please see the code below:
Is the code above correct? Or should/can we write the end portion as below?
Thanks in advance
Rajesh
I see there are many discussions on BEGIN TRAN.... END TRAN...
However, I have a straight query which may sound weird.
Is an "END TRANSACTION" necessary in a BEGIN TRANSACTION...END TRANSACTION routine?
When we use ROLLBACK to reverse the changes, is there a need to mention END TRANSACTION at the end?
To be more clearer, please see the code below:
Code:
BEGIN TRANSACTION
lgood = .T.
if lGood
select emp
lGood = TABLEUPDATE(.T.)
endif
if lGood
select salary
lGood = TABLEUPDATE(.T.)
endif
if lGood
select allowances
lGood = TABLEUPDATE(.T.)
endif
if NOT lGood
ROLLBACK
endif
END TRANSACTION
Is the code above correct? Or should/can we write the end portion as below?
Code:
if NOT lGood
ROLLBACK
else
END TRANSACTION
endif
Thanks in advance
Rajesh