November 28, 2010

Lock a table

Locking a table prevents two users to update a table at same time. 
Using locks we can prevent data replications. 
 
LOCK TABLE employees
   IN EXCLUSIVE MODE;
This exclusive mode enables the user to look into the rows but can update it.
And this command for remote link tables.
LOCK TABLE employees@DB
IN SHARE MODE 
 
The alternative for this is to use sequence in your table.It will also prevent data duplications. 

No comments:

Post a Comment

Thanks for your comments submitted.,will review and Post soon! by admin.

COALESCE-SQL

Coalesce- return the null values from the expression. It works similar to a case statement where if expression 1 is false then goes to expr...