Home  >  Article  >  Backend Development  >  如何在oracle中限制返回结果集的大小_PHP

如何在oracle中限制返回结果集的大小_PHP

WBOY
WBOYOriginal
2016-06-01 12:41:03685browse

Oracle不支持类似于 MySQL 中的 limit. 但你还是可以rownum来限制返回的结果集的行数.

如果你只希望返回前十行纪录,你可以这样写:

SELECT * FROM table WHERE ROWNUM
但是下面的语句是不对的:

SELECT * FROM table WHERE ROWNUM>90 AND ROWNUM
这是因为 Oracle 认为这个条件不成立,所以没有返回。
你应该这样写:

SELECT * FROM table WHERE ROWNUMminus
SELECT * FROM table WHERE ROWNUM

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn