Optimistic locking is basically "I will lock the data only when the data changes, not when reading." The end result is that if you don’t lock the data right away, someone else can change it before you do it, and you look at the old news (and you can blindly overwrite the changes that happened between you when you read the data and update them.)
Pessimistic locking blocks data when you read it, so you are sure that no one has changed it if you decide to update it.
This is a solution for the application, not an Oracle solution like:
SELECT x, y, z FROM table1 WHERE a = 2
will not block matching entries but
SELECT x, y, z FROM table1 WHERE a = 2 FOR UPDATE
will be. Therefore, you need to decide whether you agree with the upbeat lock.
SELECT x, y, z FROM table1 WHERE a = 2
... time passes ...
UPDATE table1 SET x = 1, y = 2, z = 3 WHERE a = 2
(you could rewrite the change made by someone else in the meantime)
or should be pessimistic:
SELECT x, y, z FROM table1 WHERE a = 2 FOR UPDATE
... time passes ...
UPDATE table1 SET x = 1, y = 2, z = 3 WHERE a = 2
(You are sure that no one has changed the data since you requested it.)
Check here isolation levels available in Oracle. http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/consist.htm#CNCPT621