LAG (column_name,offset,default)
Argument
| Required/
Optional
| Description
|
---|---|---|
column_name
| Required
| The target column or expression that the function operates on.
|
offset
| Required
| Integer data type. The number of rows before the current row from which to obtain a value.
|
default
| Optional
| The default value to return if the offset is outside the bounds of the partition or table. Default is NULL.
You can specify a default argument that is the same data type as the input value or goes with the offset argument.
You cannot specify a default argument that contains a complex data type or a SYSTIMESTAMP argument.
|
LAG ( ORDER_DATE, 1, NULL )
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DATE_DIFF( EVENT_TIME, LAG ( EVENT_TIME, 1, NULL ), 'ss' )
|
|
|
|
---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|