Monday, October 05, 2009

LAG() AND LEAD() FUNCTION

THIS LAG() AND LEAD() FUNCTION RETURNS THE PREVIOUS OR NEXT ROW VALUE.

EXAMPLE:

LAG(OUT_TIME) OVER (PARTITION BY BADGENO ORDER BY
BADGENO,OUT_DATE,OUT_TIME)

Here the BADGENO is taken as group by and user orderby according to the

specified sequence in the cluase.