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
What are the DBMS languages? Briefly explain? Data Definition language (DDL):A database schema is specified through a set of definitions expressed through a special language

Have database built but having problems with some questions that go with the database

Illustrate different types of Locks in SQL Server. There are three kinds of locks in SQL Server i.) Shared locks - These are used for operations which don't allow any update

why are older data models are being replaced by new data models

Although how will the system recover The selection of REDO or UNDO for a transaction for the recovery is completed on the basis of the state of the transactions. This state is

Relational Algebra is a set of basic operations used to influence the data in relational model. These operations allow the user to specify basic retrieval request. The result of re

What do you understand by ACID? - ACID (Atomicity Consistency Isolation Durability) is a quality sought after in a reliable database. Here's the relevance of each quality:

Create 1 experiment to demonstrate an aspect of query optimisation by using access-path structures (indexes), decomposition, or denormalisation. Once satisfied with your experiment

What are data models? Explain it detail? Entity relationship model Rectangles Ellipse Diamonds Lines Relational model Relational model use a collection

Define Atom of domain relational calculus An atom has the outline 1 , x 2 , ... , x n > -> r , in which r stands for a relation on n attributes and x 1 , x 2 , ... , x n ar