oracle如何做一个限制?

Oracle how to do a limit?

我必须限制为 2 行。 但不能为 SQL-Fetch 执行此操作。

select *
from employee;

您可以将查询更改为:

select *
from
  top_n_test
order by
  num
fetch first 3 rows only;

select 前 n 行仅 select 前 n 行。

嗯,最简单的方法就是

select * 
from employee
where rownum <= 2;

但问题是你到底想用它做什么。

你可以使用这样的东西:

 select *
 from  
 ( select * 
 from emp 
 order by data desc ) 
 where ROWNUM <= 2;