Originally posted by slimdave
My quick guess is that you are using 8i, where PL/SQL uses a SQL engine that does not recognise the analytical function format. You can use DBMS_SQL or execute immediate to make it use the regular SQL engine. What you lose in performance by that technique you'd probably recover in the speed of the SQL statement itself
Dave,

Thanks for the reply.

Yep,we use 8i... I do my initial development with 8iPE on my local computer.

...using 8i, where PL/SQL uses a SQL engine that does not recognise the analytical function format.
Well, I had a feeling it was something like that, but I couldn't locate anything to confirm it. Our upgrade path indicates that we won't be moving to 9i until next year some time.... oh well...

I doubt it would be worth it to execute it as dynamic SQL since it is only getting 6 rows at most on the inner select. Thank you for your insight though

Cheers,
Keith.