Quantcast
Viewing latest article 3
Browse Latest Browse All 4

SQL to get the profile option values

The following SQLs gives the profile option values for all the levels, i.e. responsibilities, users, etc.
-- Get profile option value at all levels for profile option name ORG_ID
SELECT   po.profile_option_name "NAME", po.user_profile_option_name,
         DECODE (TO_CHAR (pov.level_id),
                 '10001', 'SITE',
                 '10002', 'APP',
                 '10003', 'RESP',
                 '10005', 'SERVER',
                 '10006', 'ORG',
                 '10004', 'USER',
                 '???'
                ) "LEV",
         DECODE (TO_CHAR (pov.level_id),
                 '10001', '',
                 '10002', app.application_short_name,
                 '10003', rsp.responsibility_name,
                 '10005', svr.node_name,
                 '10006', org.NAME,
                 '10004', usr.user_name,
                 '???'
                ) "CONTEXT",
         pov.profile_option_value "VALUE"
    FROM fnd_profile_options_vl po,
         fnd_profile_option_values pov,
         fnd_user usr,
         fnd_application app,
         fnd_responsibility_vl rsp,
         fnd_nodes svr,
         hr_operating_units org
   WHERE 1 = 1
     AND pov.application_id = po.application_id
     AND pov.profile_option_id = po.profile_option_id
     AND usr.user_id(+) = pov.level_value
     AND rsp.application_id(+) = pov.level_value_application_id
     AND rsp.responsibility_id(+) = pov.level_value
     AND app.application_id(+) = pov.level_value
     AND svr.node_id(+) = pov.level_value
     AND org.organization_id(+) = pov.level_value
     AND po.profile_option_name = 'ORG_ID'
ORDER BY "NAME", pov.level_id, "VALUE"

We have selected the ORG_ID profile from the database. The output will look like the following,We have selected the ORG_ID profile from the database. The output will look like the following,

Thanks to Arun Rathod (arunrathod.blogspot.com) for providing the query.

There is an alternate query

SELECT fpo.profile_option_id, fpot.profile_option_name profile_short_name
, substr(fpot.user_profile_option_name,1,60) profile_name
, DECODE(fpov.level_id,10001,'site',10002,'Appl',10003,'Resp',10004,'User') profile_level
, substr(DECODE(fpov.level_id,10001,null, 10002,fa.application_short_name
,10003,fr.responsibility_name, 10004,fu.user_name),1,30) level_value
, fpov.profile_option_value profile_value
FROM fnd_profile_option_values fpov
, fnd_profile_options fpo
, fnd_profile_options_tl fpot
, fnd_application fa
, fnd_responsibility_tl fr
, fnd_user fu
WHERE 1 = 1
and fpo.profile_option_name=fpot.profile_option_name
and fpo.profile_option_id = fpov.profile_option_id
and fa.application_id(+)=fpov.level_value
and fr.responsibility_id(+)=fpov.level_value
and fu.user_id(+)=fpov.level_value
and fpo.profile_option_name like 'PO%'
/*
and (fpo.profile_option_name like nvl('X',fpo.profile_option_name) -- Not mandatory. Replace X with profile short name, ie 'ORG_ID'
or fpot.user_profile_option_name like nvl('MO: Op%',fpot.user_profile_option_name)) -- Not mandatory. Replace Y with profile user name, ie 'MO: Op%'
*/

This query will display the profile options that start with “PO“. You can modify the query according to your needs. If you execute the query the output will be like the following

Image may be NSFW.
Clik here to view.

You can decide which query suits your requirement.

Cheers!


Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing latest article 3
Browse Latest Browse All 4

Trending Articles