using analytic functions in pl/sql
Can you use analytic functions such as ratio_to_report and rank in a PL/SQL function? the following statement that works from my oracle client will not compile inside of a pl/sql block.
select
answer_key as investor_style,
count(distinct fe.business_id) curr,
ratio_to_report(count(distinct fe.business_id)) over()
from
demographics d,
formal_entities fe
where d.owner_key_num = fe.key_num
and d.owner_prof_name = 'CC_BUSINESS_FRML_FE_PROF'
and d.prof_name = 'TSC_CC_DEMOGRAPHIC_DE_PROF'
and d.question_key = 'INVESTING_STYLE'
and fe.tsc_registration_date >= trunc(fDate)
and fe.tsc_registration_date < trunc(tDate)
group by answer_key
thanks