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
Many-to-many : Entities in A and B are related with any number of entities from each other. Example: Taught_by Relationship among course and faculty. One faculty member ca

statical data

Why containment is important in oosystems? Containment is an significant concept in oosystems because it allows dissimilar users to view data at different granularities.

need to get answer for questions 3&4 on this page in part 1

Develop Database academic assignment Project Description: For a provided set of instructions in a case study design Entity Relationship Diagram. - Entity Relationship Diag

What is DDL? Make a list of commands with short description used in DDL Ans: Data Definition Language that is abbreviated as DDL is a computer language for defining data struct

Consider a database application that deals with an Employee relation with information such as SIN, name, data of birth (DOB), and DID (the ID of the department at which the employe

These are the binary operations; i.e., each is applied to two relations or sets. These two relations can be union compatible excluding in case of Cartesian product. Two relations R

Explain the two types of participation constraint. 1. Total: The participation of an entity set E in a relationship set R is said to be total if each entity in E participates i

Differentiate between Primary and secondary storage? Primary and secondary storage - Primary storage device stores the data temporarily. Primary storage is commonly used thro