oracle分页

oracle分页

我用的是mybatis:
select

from (select c.
, rownum rn from (select * from customer) c where rownum <= #{max})
where rn > #{min}

注意第一次对…

我用的是mybatis:

select
*
from (select c.*, rownum rn from (select * from customer) c where rownum <= #{max})
where rn > #{min}

注意第一次对rownum进行条件判断的时候不能用别名rn,下面是错的,会提示
java.sql.SQLSyntaxErrorException: ORA-00904: "RN": invalid identifier

select
*
from (select c.*, rownum rn from (select * from customer) c where rn <= #{max})
where rn > #{min}

理解别名的使用,是在查询的结果中使用,查询时并不能使用别名作为判断条件中的一个元素

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×