OracleWindow FunctionsLAST_VALUE
FIRST_VALUE

LAST_VALUEWindow Functions

NTH_VALUE

Returns the last value in the window frame.

Syntax

LAST_VALUE(expr) OVER (w)

Example

Enter values below to update the example in real time.

employee_id
salary
hire_date
last_val
employees
SELECT employee_id, salary,
       LAST_VALUE(salary) OVER (
         ORDER BY hire_date
         ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
       ) AS last_val
FROM employees;