Take the 2-minute tour ×

I have an oracle form, where the lock procedure property of a data block is set to call a procedure 'lock_fn'. The procedure 'lock_fn' looks like below:

procedure lock_fn(outp IN OUT out_tab) IS
l_first BINARY_INTEGER := outp.first;
l_last BINARY_INTEGER := outp.last;
l_id a.id%type;
    for i in  l_first .. l_last loop
        select id
        into   l_id
        from a
        where a.id=outp(i).id;
    end loop;
END lock_fnl;

My question is, Would merely selecting the ids guarantee a row level lock?. Any help would be most welcome.

Edit: The LOCK-PROCEDURE trigger of the data block has the code auto-generated that looks like below:

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Would merely selecting the ids guarantee a row level lock?

No. You'd need a SELECT FOR UPDATE (But then selecting just a single column would be sufficient).

share|improve this answer
Thanks for quick reply. Would the code in question do any good at all with regards to locking?. I found it in one of the forms in production. –  digdug Aug 16 '11 at 11:59
Maybe I am missing something, but it does look like a no-op. Just selecting will not obtain any locks, and so will neither block anyone else nor be blocked by anyone else. –  Thilo Aug 16 '11 at 12:54
add comment

Your Answer


