Listing 7: Alternative to AQ
create or replace function get_a_row return t%rowtype
as
l_rec t%rowtype;
begin
for x in ( select rowid rid from t <where> )
loop
begin
select * into l_rec
from t
where rowid = x.rid
FOR UPDATE NOWAIT;
return l_rec;
exception
when others then NULL;
end;
end loop;
return NULL;
end;
|