How to react to locked records in an application?

m.rup

Member²
Hi, how can I tell TOracleQuery and TOracleDataSet not to wait when running across a record already locked by another user but to throw an exception or something else so the application will not freeze until the locked record is unlocked?

Thanks in advance

Martin
 
For a TOracleQuery you will first need to explicitly lock the record. For example:

Code:
select * from dept
where deptno=10
for update nowait

The "for update nowait" clause causes the record to be locked by your session, and will immediately raise an exception when the record was already locked by another session.

For the TOracleDataSet this is already the default behavior (check the LockingMode property documentation for more information).
 
Back
Top