I am trying to use Oracle's new analytical function "Rank()" in a PL/SQL cursor
variable or a cursor for loop. However, the PL/Sql engine doesn't seem to
be recognizing the syntax and I am receiving a PLS-00103 error " Encountered
the symbol "(" when expecting: , from". Here's a snippet of the code:

BEGIN
FOR c_rec IN
( SELECT
Time_Period,
Category,
Rank() over ( PARTITION BY Time_Period,
Category,
Prd_Grp_Name
ORDER BY Time_Period,
Category )
FROM dmIMD_Owner.IMDTrdCube_Tbl t
ORDER BY Time_Period,
Category ,
Rpt_Srt)
LOOP

<< do stuff here >>

END LOOP;

END;


ORA-06550: line 10, column 21:
PLS-00103: Encountered the symbol "(" when expecting one of the following:

, from



Any suggestions would be appreciated.

Thanks,
Johnetta