1
dpt_no   salary  period        start_date       end_date
------   -----   ------        ----------       --------
100 12580   15months    12-DEC-07   10-DEC-10
101 15500   19months    10-JAN-07   10-DEC-11
102 7777    18months    11-JUL-07   21-APR-11
103 9999    11months    07-JUL-07   31-JAN-11
104 8500    9months         12-MAR-07   27-MAR-11
105 10000   20months    17-SEP-07   01-AUG-11
106 25000   7months         17-NOV-07   26-JUL-11
107 100000  6months     05-MAY-07   21-JUN-11
108 35000   16months    28-FEB-08   21-JUN-11
109 5000    16months    02-DEC-08   19-AUG-11

我正在编写查询以赋予薪水等级并使用&符号获得该等级。该查询是

select salary from salary 
where &RANK=(select salary, rank() over(order by salary desc) 
as "rank" from salary  salary).

但我收到错误为“太多值”。谁能帮帮我

4

1 回答 1

1

它应该是这样的:

select t1.salary from 
(select salary.salary, 
         rank() over(order by salary desc) 
as "rank" from salary) t1
where "rank"=&RANK

SQLFiddle 演示

于 2013-08-20T05:50:43.967 回答