select
null action_,
null status_,
null message_,
null modified_columns_,
x.*,
to_number(null) upload_row
from
(
select
rowidtochar(fpov.rowid) row_id,
fpo.user_profile_option_name profile_option,
fpo.profile_option_name profile_option_code,
decode(fpov.level_id,10001,'Site',10002,'Application',10003,'Responsibility',10004,'User',10005,'Server',10006,'Operating Unit',10007,decode(fpov.level_value,-1,'Server','Responsibility')) level_,
decode(fpov.level_id,10002,fav.application_name,10003,frv.responsibility_name,10004,fu.user_name,10005,fn.node_name,10006,haouv.name,10007,nvl(frv.responsibility_name,fn.node_name)) level_value,
fav_r.application_name responsibility_application,
decode(fpov.level_id,10007,decode(fpov.level_value,-1,null,fn.node_name)) server,
xxen_util.display_profile_option_value(fpov.application_id,fpov.profile_option_id,fpov.profile_option_value) profile_option_value
from
fnd_profile_options_vl fpo,
fnd_profile_option_values fpov,
fnd_application_vl fav,
fnd_responsibility_vl frv,
fnd_application_vl fav_r,
fnd_user fu,
fnd_nodes fn,
hr_all_organization_units_vl haouv
where
fpo.start_date_active<=sysdate and
nvl(fpo.end_date_active,sysdate)>=sysdate and
fpo.application_id=fpov.application_id and
fpo.profile_option_id=fpov.profile_option_id and
decode(fpov.level_id,10002,fpov.level_value)=fav.application_id(+) and
case when fpov.level_id in (10003,10007) then fpov.level_value end=frv.responsibility_id(+) and
case when fpov.level_id in (10003,10007) then fpov.level_value_application_id end=frv.application_id(+) and
frv.application_id=fav_r.application_id(+) and
decode(fpov.level_id,10004,fpov.level_value)=fu.user_id(+) and
decode(fpov.level_id,10005,fpov.level_value,10007,fpov.level_value2)=fn.node_id(+) and
decode(fpov.level_id,10006,fpov.level_value)=haouv.organization_id(+)
) x
where
1=1 |