Oracle - MySQL to achieve the limit function

MySQL's limit function is to obtain a specified number of rows of data, Oracle is not the limit, but there are other methods.

Oracle database does not support the number of rows in mysql limit function, but can restrict the result set returned by the rownum, rownum is not user-added fields, but the oracle system automatically added.

(1) the query results are returned up to the first 10 rows:

select * from OB_CALL_DATA_LOG where rownum<=10;

(2) reacting the intermediate query results are returned in line 10 to 100:

如:     select * from OB_CALL_DATA_LOG rownum<101  minus  select * from OB_CALL_DATA_LOG rownum>9

Note: select * from OB_CALL_DATA_LOG and rownum> 99 and rownum <101 is wrong, oracle would think that condition is not met

Guess you like

Origin www.cnblogs.com/sunylat/p/10936332.html