using LOCKS in oracle

Ij
Posted by Ij under Oracle category on | Points: 40 | Views : 321
---It protects a table, several users are acess in same table
---it helps the data integrity while accesing multiple users in the same table

two types are locks available in oracle
1.row level
2.table level

row level lock
select * from emp where deptno=10 for update of sal;

above statement locks the data in emp table for deptno '10 but other users can able to update deptno 10 salary other can't perform.

select * from emp where deptno=10 for update; 

above statement locks the data in emp table for deptno '10 but other users can't perform any dml operations on all columns untill lock is released.

table level lock
The type of lock. It must be one of the following: ROW SHARE, ROW EXCLUSIVE, SHARE UPDATE, SHARE, SHARE ROW EXCLUSIVE, or EXCLUSIVE.
syntax
 LOCK TABLE [schema.] table [options] IN lockmode MODE [NOWAIT]

Comments or Responses

Login to post response