[译]Oracle API  Profile 的应用

标题:Oracle API Availability - Profile

来源:http://www.oracleappshub.com/api/oracle-api-availability-profile/

作者: Sanjit Anand

在Oracle中,用户相关配置信息都可以通过FND_PROFILE 包和FNDSQF 库获取.

这个API可以有以下两个应用:
1.获取当前运行环境中用户的相关配置文件的值
2.可以在当前运行环境下对用户的相关配置进行设置

我们可以通过调用这个API中的各种object来获取我们想要的东西.

1. Put :
用於指定持定User的相关配置信息

•FND_Profile.Put('PROFILE_NAME','New_Value')
•FND_Profile.Put('USERNAME', Usr_Name)
•FND_Profile.Put('RESP_ID', Resp_ID)
•FND_Profile.Put('RESP_APPL_ID', Resp_App_ID)
•FND_Profile.Put('USER_ID', User_ID)



2.Defined 定义
Select fnd_profile.defined('ACCOUNT_GENERATOR:DEBUG_MODE') ACC_GEN_DEBUG_SESSION_MODE FROM DUAL;

3.Get 获取Profile值

不同的Profile值可以通过Get来获取
•FND_Profile.Get('PROFILENAME', Profile_name);
•FND_Profile.Get('CONC_LOGIN_ID', Conc_login_id);
•FND_Profile.Get('LOGIN_ID', loginid);

4.Value 的值

这个Function返回一个字符值。用于返回当前环境下用户的有相关profile的值

•fnd_profile.value('PROFILEOPTION')
•fnd_profile.value('MFG_ORGANIZATION_ID')
•fnd_profile.value('login_ID')
•fnd_profile.value('USER_ID')
•fnd_profile.value('USERNAME')
•fnd_profile.value('CONCURRENT_REQUEST_ID')
•fnd_profile.value('GL_SET_OF_BKS_ID')
•fnd_profile.value('ORG_ID')
•fnd_profile.value('SO_ORGANIZATION_ID')
•fnd_profile.value('APPL_SHRT_NAME')
•fnd_profile.value('RESP_NAME')
•fnd_profile.value('RESP_ID')

5.VALUE_WNPS: 在没有指定用户的情况下,获取当前环境下的用户的Profile值,返回的是一个字符集


6.SAVE_USER 及save:将用户的Profile值保存在数据库中,当使用此命令时,需要通过commit命令.如果操作成功则返回True值,失败则返回false

•fnd_profile.save('GUEST_USER_PWD', 'GUEST/ORACLE', 'SITE');


8.INITIALIZE : 初始化 此命令将会先将数据库的cache给清空掉 主要用于在应用程序中对profile值进行初始化操作.

________________________________________________________________

常用的一些:
取得application_id
select FND_PROFILE.VALUE('RESP_APPL_ID') from dual
方法2:fnd_form  fnd_application 來取得
取得当前 responsibility.有application的short name
FND_PROFILE.VALUE('APPL_SHRT_NAME')
可能會不支持,此為user guid 的一個錯誤
用戶所擁有的 Responsibiltyselect * from FND_USER_RESP_GROUPS;取得當前responsibility名稱fnd_profile.value('RESP_NAME')fnd_profile.value('RESP_ID')

________________________________________________________________


另附:
FND_PROFILE: User Profile APIs
This section describes user profile APIs you can use in your PL/SQL procedures. You can use these user profile routines to manipulate the option values stored in client and server user profile caches.

On the client, a single user profile cache is shared by multiple form sessions. Thus, when Form A and Form B are both running on a single client, any changes Form A makes to the client's user profile cache affect Form B's run-time environment, and vice versa.

On the server, each form session has its own user profile cache. Thus, even if Form A and Form B are running on the same client, they have separate server profile caches. Server profile values changed from Form A's session do not affect Form B's session, and vice versa.

Similarly, profile caches on the server side for concurrent programs are separate. Also, note that the server-side profile cache accessed by these PL/SQL routines is not synchronized with the C-code cache. If you put a value using the PL/SQL routines, it will not be readable with the C-code routines.

Any changes you make to profile option values using these routines affect only the run-time environment. The effect of these settings ends when the program ends, because the database session (which holds the profile cache) is terminated. To change the default profile option values stored in the database, you must use the User Profiles form.

FND_PROFILE.PUT
Summary

procedure FND_PROFILE.PUT

         (name      IN varchar2,
          value     IN varchar2);
Location

FNDSQF library and database (stored procedure)

Description

Puts a value to the specified user profile option. If the option does not exist, you can also create it with PUT.

All PUT operations are local--in other words, a PUT on the server affects only the server-side profile cache, and a PUT on the client affects only the client-side cache. By using PUT, you destroy the synchrony between server-side and client-side profile caches. As a result, we do not recommend widespread use of PUT.

Arguments (input)


name  The (developer) name of the profile option you want to set.  
value  The value to set in the specified profile option.  

FND_PROFILE.GET
Summary

procedure FND_PROFILE.GET

         (name      IN varchar2,
          value     OUT varchar2);
Location

FNDSQF library and database (stored procedure)

Description

Gets the current value of the specified user profile option, or NULL if the profile does not exist. All GET operations are satisfied locally--in other words, a GET on the server is satisfied from the server-side cache, and a GET on the client is satisfied from the client-side cache.

The server-side PL/SQL package FND_GLOBAL returns the values you need to set Who columns for inserts and updates from stored procedures. You should use FND_GLOBAL to obtain Who values from stored procedures rather than using GET, which you may have used in prior releases of oracle Applications.

Related Essays: Global APIs for PL/SQL Procedures (See page )


Arguments (input)


name  The (developer) name of the profile optionwhose value you want to retrieve.  

Arguments (output)


value  The current value of the specified user profile option as last set by PUT or as defaulted in the current user's profile.  

Example

FND_PROFILE.GET ('USER_ID', user_id);

FND_PROFILE.VALUE
Summary

function FND_PROFILE.VALUE

         (name      IN varchar2) return varchar2;
Location

FNDSQF library and database (stored function)

Description

VALUE works exactly like GET, except it returns the value of the specified profile option as a function result.

Arguments (input)


name  The (developer) name of the profile option whose value you want to retrieve.  


[本日志由 admin 于 2009-11-05 05:41 PM 编辑]
上一篇: Oracle EBS: EBS常用SQL
下一篇: Oracle EBS:常用SQL语句(2)
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: FND_PROFILE FNDSQF FND_PROFILE 用法
相关日志:
评论: 0 | 引用: 0 | 查看次数: 7379
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 邮件地址支持Gravatar头像,邮箱地址不会公开.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 30 字 | UBB代码 关闭 | [img]标签 关闭