ORA-30483: window functions are not allowed here

ORA-30483: window functions are not allowed here

Oracle PL/SQL error message: ORA-30483: window functions are not allowed here.

Cause:

Window functions are allowed only in the SELECT list of a query. A window function cannot be a group function.

Solution:

Correct the syntax, then retry the operation.

Course table

COURSE_IDNAMEPRICE
1SQL 110
2SQL 250
3HTML510
4PHP75
5CSS20
6Java200
100Python89

Example:

select  name, price, 
rank() over (order by price desc) course_rank
from course 
where rank() over (order by price desc) < = 3;

Output:

ORA-30483: window functions are not allowed here

Correct:

select * from (
select  name, price, 
rank() over (order by price desc) course_rank
from course ) c
where course_rank < = 3;

Output:

NAMEPRICECOURSE_RANK
Java2001
Python892
PHP753