PL/SQL Lead

Oracle PL/SQL Lead Function

The Lead function returns values from the next row in the table.

The Lead Function syntax:

lead ( exp [, offset [, default] ] )

over ( [ query_partition_clause ] order_by_clause )

Example:

Select job_id, start_date, 
lead (start_date,1) over (ORDER BY start_date) AS next_start_date
From employee
Where job_id = 3500;
Job_IdStart_DateNext_Start_Date
350020/02/200822/02/2008
350022/02/200823/02/2008
350023/02/2008NULL