本文发表在 rolia.net 枫下论坛不过俺的限制条件太多了,只有Select的权限,俺的电脑也不能直接连到Server上,否则在俺电脑的Oracle Database里建个DB Link,运行几个SQL就搞定了。
最后,俺写了个复杂的SQL,把每个B做成一张表(B数量有限),再将它们连起来,运行起来也还不算太慢,300+记录用了20+秒,一天运行几次还可以接受,但是结果一步到位,不用再处理了。
SELECT frt.responsibility_name "Responsibility",
sob.profile_option_value "GL Set of Books Name",
mrc_sob.profile_option_value "MRC: Reporting Set Of Books",
mo_ou.profile_option_value "MO: Operating Unit",
mo_dou.profile_option_value "MO: Default Operating Unit",
hr_user_type.profile_option_value "HR:User Type",
project_update.profile_option_value "PA: Cross Project -- Update",
project_view.profile_option_value "PA: Cross Project -- View"
FROM apps.fnd_responsibility_tl frt,
(SELECT level_value responsibility_id, profile_option_value
FROM apps.fnd_profile_option_values
WHERE level_id = 10003 AND profile_option_id = 1202) sob,
(SELECT fpov.level_value responsibility_id,
gsob.NAME profile_option_value
FROM apps.fnd_profile_option_values fpov,
apps.gl_sets_of_books gsob
WHERE fpov.level_id = 10003
AND fpov.level_value = 57202
AND fpov.profile_option_id = 2351
AND fpov.profile_option_value = gsob.set_of_books_id) mrc_sob,
(SELECT fpov.level_value responsibility_id,
hou.NAME profile_option_value
FROM apps.fnd_profile_option_values fpov,
apps.hr_organization_units_v hou
WHERE fpov.level_id = 10003
AND fpov.profile_option_id = 1991
AND fpov.profile_option_value = hou.organization_id) mo_ou,
(SELECT fpov.level_value responsibility_id,
hou.NAME profile_option_value
FROM apps.fnd_profile_option_values fpov,
apps.hr_organization_units_v hou
WHERE fpov.level_id = 10003
AND fpov.profile_option_id = 5799
AND fpov.profile_option_value = hou.organization_id) mo_dou,
(SELECT level_value responsibility_id,
DECODE (profile_option_value,
'PER', 'HR User',
'INT', 'HR with Payroll User',
'PAY', 'Payroll User',
''
) profile_option_value
FROM apps.fnd_profile_option_values
WHERE level_id = 10003 AND profile_option_id = 1207) hr_user_type,
(SELECT fpov.level_value responsibility_id,
DECODE (fpov.profile_option_value,
'Y', 'Yes',
'N', 'No',
''
) profile_option_value
FROM apps.fnd_profile_option_values fpov
WHERE fpov.level_id = 10003 AND fpov.profile_option_id = 5) project_update,
(SELECT fpov.level_value responsibility_id,
DECODE (fpov.profile_option_value,
'Y', 'Yes',
'N', 'No',
''
) profile_option_value
FROM apps.fnd_profile_option_values fpov
WHERE fpov.level_id = 10003 AND fpov.profile_option_id = 4983) project_view
WHERE frt.LANGUAGE = 'US'
AND frt.creation_date >= '01-NOV-2006'
AND frt.responsibility_id = sob.responsibility_id(+)
AND frt.responsibility_id = mrc_sob.responsibility_id(+)
AND frt.responsibility_id = hr_user_type.responsibility_id(+)
AND frt.responsibility_id = mo_ou.responsibility_id(+)
AND frt.responsibility_id = mo_dou.responsibility_id(+)
AND frt.responsibility_id = project_update.responsibility_id(+)
AND frt.responsibility_id = project_view.responsibility_id(+)
ORDER BY frt.responsibility_name更多精彩文章及讨论,请光临枫下论坛 rolia.net
最后,俺写了个复杂的SQL,把每个B做成一张表(B数量有限),再将它们连起来,运行起来也还不算太慢,300+记录用了20+秒,一天运行几次还可以接受,但是结果一步到位,不用再处理了。
SELECT frt.responsibility_name "Responsibility",
sob.profile_option_value "GL Set of Books Name",
mrc_sob.profile_option_value "MRC: Reporting Set Of Books",
mo_ou.profile_option_value "MO: Operating Unit",
mo_dou.profile_option_value "MO: Default Operating Unit",
hr_user_type.profile_option_value "HR:User Type",
project_update.profile_option_value "PA: Cross Project -- Update",
project_view.profile_option_value "PA: Cross Project -- View"
FROM apps.fnd_responsibility_tl frt,
(SELECT level_value responsibility_id, profile_option_value
FROM apps.fnd_profile_option_values
WHERE level_id = 10003 AND profile_option_id = 1202) sob,
(SELECT fpov.level_value responsibility_id,
gsob.NAME profile_option_value
FROM apps.fnd_profile_option_values fpov,
apps.gl_sets_of_books gsob
WHERE fpov.level_id = 10003
AND fpov.level_value = 57202
AND fpov.profile_option_id = 2351
AND fpov.profile_option_value = gsob.set_of_books_id) mrc_sob,
(SELECT fpov.level_value responsibility_id,
hou.NAME profile_option_value
FROM apps.fnd_profile_option_values fpov,
apps.hr_organization_units_v hou
WHERE fpov.level_id = 10003
AND fpov.profile_option_id = 1991
AND fpov.profile_option_value = hou.organization_id) mo_ou,
(SELECT fpov.level_value responsibility_id,
hou.NAME profile_option_value
FROM apps.fnd_profile_option_values fpov,
apps.hr_organization_units_v hou
WHERE fpov.level_id = 10003
AND fpov.profile_option_id = 5799
AND fpov.profile_option_value = hou.organization_id) mo_dou,
(SELECT level_value responsibility_id,
DECODE (profile_option_value,
'PER', 'HR User',
'INT', 'HR with Payroll User',
'PAY', 'Payroll User',
''
) profile_option_value
FROM apps.fnd_profile_option_values
WHERE level_id = 10003 AND profile_option_id = 1207) hr_user_type,
(SELECT fpov.level_value responsibility_id,
DECODE (fpov.profile_option_value,
'Y', 'Yes',
'N', 'No',
''
) profile_option_value
FROM apps.fnd_profile_option_values fpov
WHERE fpov.level_id = 10003 AND fpov.profile_option_id = 5) project_update,
(SELECT fpov.level_value responsibility_id,
DECODE (fpov.profile_option_value,
'Y', 'Yes',
'N', 'No',
''
) profile_option_value
FROM apps.fnd_profile_option_values fpov
WHERE fpov.level_id = 10003 AND fpov.profile_option_id = 4983) project_view
WHERE frt.LANGUAGE = 'US'
AND frt.creation_date >= '01-NOV-2006'
AND frt.responsibility_id = sob.responsibility_id(+)
AND frt.responsibility_id = mrc_sob.responsibility_id(+)
AND frt.responsibility_id = hr_user_type.responsibility_id(+)
AND frt.responsibility_id = mo_ou.responsibility_id(+)
AND frt.responsibility_id = mo_dou.responsibility_id(+)
AND frt.responsibility_id = project_update.responsibility_id(+)
AND frt.responsibility_id = project_view.responsibility_id(+)
ORDER BY frt.responsibility_name更多精彩文章及讨论,请光临枫下论坛 rolia.net