Sunday, January 6, 2013

Lock table clause changes in Oracle 11.1 and above.

In Oracle 11.1 and above you can set wait time for LOCK TABLE clause.
Default value for lock table clause is WAIT . And with that lock table clause will wait as long it gets the lock for the table. But you can give also waith time for lock table clause with command like this:
LOCK TABLE <table_name> IN <lock_mode> MODE WAIT <seconds to wait>;
For example:
SQL> LOCK TABLE test1 IN exclusive MODE WAIT 60;


And if you use NOWAIT instead of WAIT then lock table clause will give error straight away if it does not get table lock for table.

No comments:

Post a Comment