Lock a table as specified
1 table.lock
<table.lock
table='table'
mode='mode'
/>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Atable | string | Name of the desired table to be blocked. | |||
Amode | string | Table lock mode. |
Returns | |
---|---|
Type | Description |
Boolean | 1 is returned if the function was successful. |
Exceptions
Database required.
he database needs to be specified.
The specified table is not in the database.
The table does not exist.
Required attribute [...]
A required attribute has not been reported.
Remarks
There are essentially two types of blocking on a table:
- Shared: allows other transactions to read data from the table (SELECT), but not update records of it (INSERT, UPDATE, DELETE).
- Exclusive: prevents other transactions from reading the contents of a table, and even less, updating it.
To block a table, it is necessary that the user is identified and that a database is selected. This is reported using the -use and -dbms options of the ws-dbscript command.
If a table is locked and an external process tries to make a transaction against it, the system will wait for the table to be released. If the timeout exceeds the maximum time set in the database, an exception will be thrown.
Remarks
In the lock mode EXCLUSIVE, the ORACLE database engine does allow SELECTS to be performed against the specified table.
Table lock statement.
<table.lock table='name_of_table1' mode='share' /> <table.lock table='name_of_table2' mode='exclusive' />