常用SQL和链接
1.取得当前账册下ORG_ID
SELECT orgs.org_id,ou.set_of_books_id
FROM (SELECT DISTINCT prv.profile_option_value org_id
FROM apps.fnd_profile_options_vl pro,
applsys.fnd_profile_option_values prv,
(SELECT 10003 level_id, furg.responsibility_id level_value
FROM fnd_user_resp_groups_direct furg,
fnd_responsibility_vl frv
WHERE trunc(SYSDATE) BETWEEN furg.start_date AND
nvl(furg.end_date, trunc(SYSDATE))
--AND furg.user_id = 0
AND furg.responsibility_id = frv.responsibility_id
AND trunc(SYSDATE) BETWEEN frv.start_date AND
nvl(frv.end_date, trunc(SYSDATE))) lev
WHERE pro.profile_option_id = prv.profile_option_id
AND prv.level_id = lev.level_id
AND prv.level_value = lev.level_value
AND pro.profile_option_name = 'ORG_ID') orgs,
hr_operating_units ou
WHERE ou.organization_id=orgs.org_id
AND ou.set_of_books_id = :P1