Specify WITH TIES to return additional rows withthe same sort key as the last row fetched. If you specify WITH TIES, then you mustspecify the order_by_clause. If you do not specify the order_by_clause, then noadditional rows will be returned.
如果指定with ties子句,那么拥有和最后一行相同的排序键值的行都会被fetch。如果指定了with ties子句,那么必须指定order by 。如果没有指定order by,那么不会有附加的行被返回。
没有指定order by时: SQL> select job_id from jobid 2* fetch first 5 rows with ties;
JOB_ID _____________ AC_ACCOUNT AC_MGR AD_ASST AD_PRES AD_VP
指定order by后: SQL> select job_id from jobid 2 order by job_id 3* fetch first 5 rows with ties;
JOB_ID _____________ AC_ACCOUNT AC_MGR AD_ASST AD_PRES AD_VP AD_VP
6 rows selected. 结果出现区别
|