PL/SQL Median

Oracle PL/SQL Median Function

The Median function returns the median of an expression.

The Median Function syntax:

median(expression)

or

median( expression ) [ OVER ( query partition clause ) ]

Example 1:

Select median(e.sal) 
From emp e 
Where e.job='CLERK'

Example 2:

Select e.ename, e.sal
From emp e
Where e.sal = (Select Median(e1.sal) From emp e1);