1. FND_PROFILE.GET(‘Name of the Profile’,
variable name);
SELECTfnd_profile.value('PROFILEOPTION')
,fnd_profile.value('MFG_ORGANIZATION_ID')
,fnd_profile.value('ORG_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('SO_ORGANIZATION_ID')
,fnd_profile.value('APPL_SHRT_NAME')
,fnd_profile.value('RESP_NAME')
,fnd_profile.value('RESP_ID')
FROMDUAL;
SELECT fnd_profile.value('PROFILEOPTION')
,fnd_profile.value('MFG_ORGANIZATION_ID')
,fnd_profile.value('ORG_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('SO_ORGANIZATION_ID')
,fnd_profile.value('APPL_SHRT_NAME')
,fnd_profile.value('RESP_NAME')
,fnd_profile.value('RESP_ID')
FROM DUAL;
2. variable name := FND_PROFILE.VALUE(‘Name
of the profile’);
3. FND_PROFILE.PUT(‘Name of the profile’,
value of the profile);
SETSERVEROUTPUTON;
DECLARE
v_conc_login_id NUMBER;
BEGIN
FND_PROFILE.put ('CONC_LOGIN_ID',1425);
fnd_profile.get ('CONC_LOGIN_ID', v_conc_login_id);
DBMS_OUTPUT.put_line (v_conc_login_id);
END;
Output:
1425
PL/SQL proceduresuccessfully completed
SET SERVEROUTPUT ON;
DECLARE
v_conc_login_id NUMBER;
BEGIN
FND_PROFILE.put ('CONC_LOGIN_ID',1425);
fnd_profile.get ('CONC_LOGIN_ID', v_conc_login_id);
DBMS_OUTPUT.put_line (v_conc_login_id);
END;
Output:
1425
PL/SQL procedure successfully completed
FND_PROFILE.GET is the procedure and FND_PROFILE.VALUE is the
function so, it return a value.
4.FND_PROFILE.SAVE used to set the profile values from
backend.
The table
fnd_profile_options_tl, profile options names are
kept. Now find the corresponding the
Profileoption name for which you need to update from
backend. For thisexample I took my favorite
“ORG_ID”
SELECT
profile_option_name
FROM
fnd_profile_options_tl
WHERE
user_profile_option_nameLIKE'MO%'
It returns more than one row but i can make out that "ORG_ID" is
the PROFILE_OPTION_NAME for MO: Operating Unit. Now I need to know
the Org_ID of the Org whose value is to be set in MO: Operating
Unit. SO I use the simpleselect as below
SELECT
organization_id, NAME
FROM
hr_all_organization_units;
From the organization name I find the one which will be the default
Operating Unit, and I note the ID. In my case the ID for my default
Operating Unit is 286. Now with the code below I set the profile
option value using fnd_profile.save.
DECLARE
stat BOOLEAN;
BEGIN
DBMS_OUTPUT.DISABLE;
DBMS_OUTPUT.ENABLE(100000);
stat := fnd_profile.SAVE('ORG_ID',286,'SITE');
IF
stat
THEN
DBMS_OUTPUT.put_line('Stat = TRUE - profile
updated');
ELSE
DBMS_OUTPUT.put_line('Stat = FALSE - profile NOT
updated');
END IF;
COMMIT;
END;
5.fnd_profile.defined
IF (fnd_profile.defined('TRANSACTION_DATE')) THEN
l_profile_value :=
TO_NUMBER(fnd_profile.value('TRANSACTION_DATE'));
....
说明
In oracle user Profile functionality is provided in
theFND_PROFILEpackage
and the FNDSQF library.
What is inside this API:
Retrieve user profile values for the current run-time
environment
Set user profile values for the current run-time
environment
There are various Objects that can be used with this API's.
These are discussed below:
1. Put :This can be used to put a value to the
specified user profile option.
Usage:
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 :this
is function returns TRUE if a value has been assigned to the
specified profile option.
Usage:
SELECT fnd_profile.defined('ACCOUNT_GENERATOR:DEBUG_MODE')
ACC_GEN_DEBUG_SESSION_MODE FROM DUAL;
3.GET :This is used to retrieve the current
value of the specified user profile option
Usage :
Different type of options can be retrieved like
FND_Profile.Get('PROFILENAME', Profile_name);
FND_Profile.Get('CONC_LOGIN_ID', Conc_login_id);
FND_Profile.Get('LOGIN_ID', loginid);
4.VALUE :This is
function which returns a character string. Used to retrieve the
current value of the specified user profile option.
Usage:
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:This
is a function, returns a character string. This is Used to retrieve
the current value of the specified user profile option without
caching it.
6.SAVE_USER :This is function used to save a
value for a profile option permanently to the database, for the
current user level. It is necessary to explicitly issue a commit
when using this function. Returns TRUE if profile option is
successfully saved, otherwise FALSE.
7.SAVE :This is function used to save a value
for a profile option permanently to the database, for a specified
level. It is necessary to explicitly issue a commit when using this
function. Returns TRUE if profile option is successfully saved,
otherwise FALSE.
Usage
fnd_profile.save('GUEST_USER_PWD', 'GUEST/ORACLE',
'SITE');
8.INITIALIZE:This
is used by internal Applications Object Library to initialize the
internal profile information at the level context.
The cache is first cleared of all database options.
Usage:
fnd_profile.initialize(user_id);
9.PUTMULTIPLE :This is used by internal
Applications Object Library to set multiple pairs of profile
options and values.