Oracle Profile 的应用
在Oracle中,用户相关配置信息都可以通过FND_PROFILE 包和FNDSQF 库获取,这个API可以有以下两个应用:
1.获取当前运行环境中用户的相关配置文件的值;
2.可以在当前运行环境下对用户的相关配置进行设置。
我们可以通过调用这个API中的各种object来获取我们想要的东西。
1. put用于指定持定user的相关配置信息:
begin
fnd_profile.put('PROFILE_NAME', 'New_Value');end;
2.get获取profile值:
declare
profile_name varchar2(100);
begin
fnd_profile.get('PROFILENAME', profile_name);
end;
3.value获取profile值:
select fnd_profile.value('GL_SET_OF_BKS_ID') from dual;
4.常用的user配置文件名称:
USERNAME
Your user’s current Oracle Application Object Library username.
USER_ID
Your user’s current Oracle Application Object Library user ID.
RESP_ID
Your user’s current responsibility ID.
APPL_SHRT_NAME
The short name of the application connected to your user’s current responsibility.
RESP_APPL_ID
The application ID of the application connected to your user’s current responsibility.
FORM_NAME
The name of the current form. Not available for concurrent programs.
FORM_ID
The form. ID of the current form. Not available for concurrent programs.
FORM_APPL_NAME
The name of the application for which the current form. is registered. Not available for concurrent programs.
FORM_APPL_ID
The application ID of the application for which the current form. is registered. Not available for concurrent programs.
LOGON_DATE
Your user’s logon date for the current session.
LAST_LOGON_DATE
Your user’s logon date for the previous session.
LOGIN_ID
Your user’s Sign–On Audit login ID in Oracle Application Object Library.
CONC_REQUEST_ID
instance of your running current program. You can only use this profile option in a concurrent program. You use this profile option to fill the REQUEST_ID Who column.
CONC_PROGRAM_ID
The program ID associated with a running current program. You can only use this profile option in a concurrent program. You use this profile option to fill the PROGRAM_ID Who column.
CONC_PROGRAM_APPLICATION_ID
The application ID associated with a running current program. You can only use this profile option in a concurrent program. You use this profile option to fill the PROGRAM_APPLICATION_ID Who column.
CONC_LOGIN_ID
The login ID associated with a running concurrent program. You can only use this profile option in a concurrent program. You can use this profile option to fill the LAST_UPDATE_LOGIN Who column.
CONC_PRINT_OUTPUT
The value Yes or No that you enter in the Print Output field when you register a concurrentprogram. You can use the routine afpoput() fromyour concurrent programs to change the value ofthis profile option for a particular instance of yourrunning concurrent program. This profile optiondetermines whether the concurrent managers printthe concurrent program’s output to the printer.
CONC_PRINT_STYLE
The print style. of your concurrent program’soutput that you enter in the Print Style. field whenyou register a concurrent program. You can usethe routine afpoput() from your concurrentprograms to change the value of this profile option
5.扩展
取得当前user_id
FND_PROFILE.VALUE('USER_ID')
FND_GLOBAL.USER_ID 用此方式在report中有可能不好用
在report中建议用FND_WHO.PROFILE('USERID')
select fnd_profile.value('gl_set_of_books_id')
from dual
select fnd_profile.value('mfg_organization_id')
from dual --取库存组织ID
select fnd_profile.value('GL_SET_OF_BKS_ID')
from dual--取帐套 (此方式在R12中已不能使用,需要用GL_ACCESS_SET_ID再查询出LEDGER_ID)
在PL/SQL Develop中没有环境变量,所以如果要查询多组织的View,需要先执行设置环境变量函数
begin dbms_application_info.set_client_info(81); end;
与
begin fnd_client_info.set_org_context(82); end;
效果一样,这个81是指OU_ID,业务实体的ID。