Example of transaction? , Database Management System

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.

Posted Date: 3/11/2013 5:19:23 AM | Location : United States







Related Discussions:- Example of transaction? , Assignment Help, Ask Question on Example of transaction? , Get Answer, Expert's Help, Example of transaction? Discussions

Write discussion on Example of transaction?
Your posts are moderated
Related Questions
Consider employee (e_no, e_name, e_salary, d_code), dept (d_code, d_name) and dependent (depndt_name, e_no, relation). Show the names of employees in purchase and accounts departm

define locking in simple language and decribed it

basic structure of xml

entity relationship diagram about finance

What is the meaning of Data independence? Data independence means a programs that are not dependent on the physical attributes of data and a programs that are not dependent on

Explain concept of inheritance with support of suitable example. Inheritance Inheritance is one of milestone of object-oriented programming language as it allows a creati

in case of functional dependencies how we get the higher normal form.

What is difference between TRUNCATE and DELETE? - Truncate can't be rolled back whereas Delete can be. - Truncate keeps the lock on table whereas Delete keeps the lock on ea

Object-based Models: Use objects as key data representation components . Examples:-   Entity-Relationship Model: It is a collection of real world objects known as entitie