How to add offset in a “select” query in Oracle 11g?

后端 未结 3 716
一整个雨季
一整个雨季 2020-12-06 06:22

How to add an offset in a \"select\" query in Oracle 11g. I only know how to add the limit by e.g rownum <= 5 this question is not a duplicate, I already che

3条回答
  •  既然无缘
    2020-12-06 06:52

    Use the function LAG or LEAD in oracle

    The LAG function is used to access data from a previous row
    
    The LEAD function is used to return data from the next row
    

    Usage:-

    LAG  (value_expression [,offset] [,default]) OVER ([query_partition_clause] order_by_clause)
    LEAD (value_expression [,offset] [,default]) OVER ([query_partition_clause] order_by_clause)
    

    Please find the this link for examples

提交回复
热议问题