简体   繁体   中英

Analytic function throwing error in Oracle SQL Developer

I am writing a very simple rank function to calculate the rank for each group by partitioning on some specific columns. The sql looks straightforward for me but I really dont understand why I am getting ORA error. Please find my sql and error as below. Any inputs would be appreciated. Thanks.

SQL :-

 SELECT *,
        RANK() OVER( PARTITION BY STUDENTID,BOOKISBN ORDER BY ISSUEDATE )  "RN"
   FROM BORROWED_BY;

Error:-

ORA-00923: FROM keyword not found where expected
00923. 00000 -  "FROM keyword not found where expected"
*Cause:    
*Action:
Error at Line: 10 Column: 9

When you use SELECT * with other columns, you need to qualify it:

SELECT bb.*,
       RANK() OVER (PARTITION BY STUDENTID, BOOKISBN ORDER BY ISSUEDATE ) as RN
FROM BORROWED_BY bb;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM