example transfers transferamount from xs account


Example:; transfers transfer_amount from x's account to y's account

; Supposes x&y both accounts exist

TRANSACTION (x, y, transfer_amount)

Start transaction

IF X AND Y exist then

READ x.balance

IF x.balance > transfer_amount THEN

x.balance = x.balance - transfer_amount

READ y.balance

y.balance = y.balance + transfer_amount

COMMIT

ELSE DISPLAY ("BALANCE IN X NOT OK") ROLLBACK

ELSE DISPLAY ("ACCOUNT X OR Y DOES NOT EXIST") End_transaction

Please note the use of 2 keywords here COMMIT and ROLLBACK. Commit makes sure that all the modifications made by transactions are made permanent. ROLLBACK ends the transactions and discards any change made by the transaction. Transactions have definite desirable properties. Let us see into those properties of a transaction.

Request for Solution File

Ask an Expert for Answer!!
Database Management System: example transfers transferamount from xs account
Reference No:- TGS0209971

Expected delivery within 24 Hours