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_ID NAME PRICE
1 SQL 1 10
2 SQL 2 50
3 HTML5 10
4 PHP 75
5 CSS 20
6 Java 200
100 Python 89

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:

NAME PRICE COURSE_RANK
Java 200 1
Python 89 2
PHP 75 3