Use analytic function
SELECT value FROM (SELECT value, dense_rank() over (order by value asc) rnk FROM table) WHERE rnk = 2
The analytic functions RANK , DENSE_RANK and ROW_NUMBER identical, except for how they handle the relationships. RANK uses a controversial style of breaking ties, so if two lines are tied to ranks 1, the next row is rank 3. DENSE_RANK gives both rows bound to the first place in rank 1, and then assigns the next row to rank 2. ROW_NUMBER randomly breaks the tie and gives one of the two rows with the lowest value, rank 1, and the second - rank 2.
Justin cave
source share