我想使用以下查询锁定一组记录:
select *
from (select *
from event_table
where status = 'S'
order by creation_data asc
)
where rownum <=10
for update;
event_table 不是视图。这是一张普通的桌子:
create table event_table
(
id number,
creation_date date,
status number,
info clob
);
主键是字段 id。
我可以使用rownum
withselect for update
吗?
是否有另一种解决方案,其中使用select for update
但也只选择一组行而不是选择的所有结果?
例如,我有一个任务运行每个 X 内部并需要select for update
用于该表,但如果选择返回 500 行,我只想每次处理 100 行(分页类型)。这就是我尝试这样做的原因rownum
。
谢谢。