Quick Search:
 
 The Oracle PL/SQL LEAD Function      [Return To Index] Jump to:  

Term: LEAD

Definition:
The Oracle PL/SQL LEAD function is an analytic function through which one can access the succeeding or following row without making any self join. It is normally used to get the value of an attribute of the previous row. Until unspecified, LEAD can access one offset row after to the current cursor position.

(If you need to retrieve a value from the previous row, use LAG instead of LEAD.)

Example Syntax:

LEAD (value_expression [,offset] [,default]) OVER ([query_partition_clase] order_by_clause)


The default value is returned in case the offset moves the cursor position beyond the scope of the result set. It is NULL by default.

Example Usage:

SELECT EMPNO, ENAME, SALARY,
LEAD(SALARY, 1, 0) OVER (ORDER BY SALARY) AS NEXT_SAL,
FROM EMPLOYEES;



Related Links:

Related Code Snippets:
  • LEAD - LEAD provides access to a row at a given physical offset beyond that position.
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org