SELECT frt.responsibility_name,
DECODE(fv.level_id, 10001, 'Site', 10002, 'Application', 10003, 'Responsibility', 10004, 'User', NULL) profile_level,
fr.responsibility_key,
frt.application_id resp_appl_id,
frt.responsibility_id resp_id,
b.profile_option_id,
fv.profile_option_value,
t.profile_option_name,
t.user_profile_option_name,
b.sql_validation
FROM fnd_profile_options_tl t,
fnd_profile_options b,
fnd_profile_option_values fv,
fnd_responsibility_tl frt,
fnd_responsibility fr
WHERE b.profile_option_name = t.profile_option_name
AND t.language = USERENV('LANG')
AND frt.language = USERENV('LANG')
AND b.profile_option_id = fv.profile_option_id
--AND fv.level_id = 10003 --Resp Level
--AND fv.level_value_application_id = 660 --resp_appl_id
--AND fv.level_value = 53387 --resp_id
AND frt.application_id = fv.level_value_application_id
AND frt.responsibility_id = fv.level_value
AND frt.application_id = fr.application_id
AND frt.responsibility_id = fr.responsibility_id
AND t.profile_option_name LIKE 'XX%'
AND frt.RESPONSIBILITY_NAME like '%Order%' ;
DECODE(fv.level_id, 10001, 'Site', 10002, 'Application', 10003, 'Responsibility', 10004, 'User', NULL) profile_level,
fr.responsibility_key,
frt.application_id resp_appl_id,
frt.responsibility_id resp_id,
b.profile_option_id,
fv.profile_option_value,
t.profile_option_name,
t.user_profile_option_name,
b.sql_validation
FROM fnd_profile_options_tl t,
fnd_profile_options b,
fnd_profile_option_values fv,
fnd_responsibility_tl frt,
fnd_responsibility fr
WHERE b.profile_option_name = t.profile_option_name
AND t.language = USERENV('LANG')
AND frt.language = USERENV('LANG')
AND b.profile_option_id = fv.profile_option_id
--AND fv.level_id = 10003 --Resp Level
--AND fv.level_value_application_id = 660 --resp_appl_id
--AND fv.level_value = 53387 --resp_id
AND frt.application_id = fv.level_value_application_id
AND frt.responsibility_id = fv.level_value
AND frt.application_id = fr.application_id
AND frt.responsibility_id = fr.responsibility_id
AND t.profile_option_name LIKE 'XX%'
AND frt.RESPONSIBILITY_NAME like '%Order%' ;