我想使用以下查询锁定一组记录:
select *
from (select *
from event_table
where status = 'S'
order by creation_data asc
)
where rownum <=10
for update;
Run Code Online (Sandbox Code Playgroud)
event_table不是视图.这是一张常规表:
create table event_table
(
id number,
creation_date date,
status number,
info clob
);
Run Code Online (Sandbox Code Playgroud)
主键是字段ID.
我可以rownum
用select for update
吗?
是否有其他解决方案,使用select for update
但只选择一组行而不是选择的所有结果?
例如,我有一个运行每个X内部并且需要select for update
用于该表的任务,但是如果select返回500行,我只想每次处理100个(分页类型).这就是我rownum
为此尝试的原因.
谢谢.
Jen*_*der 15
这有用吗?:
select * from event_table where id in
(
SELECT id
FROM (SELECT *
FROM event_table
WHERE status = 'S'
ORDER BY CREATION_DATA ASC)
WHERE ROWNUM <=10
)
FOR UPDATE;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
12755 次 |
最近记录: |