select fnd_profile.value('gl_set_of_books_id')
from dual
select fnd_profile.value('mfg_organization_id')
from dual --取子库
select fnd_profile.value('GL_SET_OF_BKS_ID')
from dual--取帐套 (此方式在R12中已不能使用,需要用GL_ACCESS_SET_ID再查询出LEDGER_ID)
用此方式調整正確的當前咝协h境,特別是在multi_org環境下(在報表前,報表後均要執行因有可能在咝羞^程中變量被人為改變)
有一些view用到org環境參數的,一般要如下設定後,才能select到記錄:
begin
dbms_application_info.set_client_info(:org_id);--如1,2,3之類的
end;
可用'FND_PROFILE.GET' function 查看以下一些參數
取得set of book id
Select fnd_profile.value('GL_SET_OF_BKS_ID') from dual
取得master_id
select fnd_profile.value('SO_ORGANIZATION_ID') from dual;
取得當前org_id
select to_number(fnd_profile.value('ORG_ID')) from dual;
org_id = :$PROFILES$.ORG_ID;也可用此來取得,在定義報表參數時來定義
fnd_profile.value('MFG_ORGANIZATION_ID') 與上的區別
取得當前user_id
select TO_NUMBER(FND_PROFILE.VALUE('USER_ID')) from dual;
FND_GLOBAL.USER_ID 用此方式在report中有可能不好用,在report中建議用上一種方式FND_WHO.PROFILE('USERID') 又一種方式取得當前login_id
select TO_NUMBER(FND_PROFILE.VALUE('login_ID')) from dual;
取得當前username
Declare
username varchar2(30);
begin
username := FND_PROFILE.VALUE('USERNAME');
end;