 |
|
Oracle Locks
Oracle Tips by
Burleson
|
Oracle uses a sophisticated lock mechanism to prevent
multiple users from altering the same data at the same time. This
mechanism is typically invisible to database users. It’s not uncommon,
especially during system development or after system hang-ups, for a
deadlock to exist.
Consider this situation: user jallen has the STUDENTS table
locked and needs to obtain a lock on the STUDENT_FINANCIAL_AID
table. User msmith has the STUDENT_FINANCIAL_AID table locked
and needs to obtain a lock on the STUDENTS table. This is a
deadlock, because each user is preventing the other from completing a
transaction.
Locks are cleared when a user issues a COMMIT or ROLLBACK
statement. Locks can also be explicitly obtained, but this is a rare
event. It’s best to let Oracle determine which objects that you need
to lock.
NULL Values
A NULL value is a column that does not have a defined value.
A NULL value is never equal to any other value, including zero
and NULL. The expression
NULL = NULL
returns a FALSE result. Any column in a table that is not
constrained by a NOT NULL or primary key constraint can
contain a NULL value.
You can test for NULL values in a column using the IS
NULL operator:
WHERE <column> IS NULL
WHERE <column> IS NOT NULL
In reality, unexpected NULL values can cause all sorts of
heartache for developers. The best way to handle this situation is to
be aware that columns can contain NULL values while you’re
coding and to be on the lookout for situations in which NULL
values are likely to be present.
This is an
excerpt from the book "High Performance Oracle Database
Automation" by Jonathan Ingram and Donald K. Burleson, Series
Editor. |