Oracle solution . Using rank function
\nCREATE FUNCTION getNthHighestSalary(N IN NUMBER) RETURN NUMBER IS\nresult NUMBER;\n\nBEGIN\nselect salary into result from (select distinct(salary),rank() ove
```\nCREATE FUNCTION getNthHighestSalary(N IN NUMBER) RETURN NUMBER IS\nresult NUMBER;\n\nBEGIN\nselect salary into result from (select distinct(salary),rank() over (order by salary desc) as r  from employee group by salary) where r=N;\nreturn result;\nEND;\n```
['Oracle']