1 package body FND_PROFILE_SERVER as
2 /* $Header: AFPFPRSB.pls 115.0 99/07/16 23:25:46 porting ship $ */
3
4 /*
5 ** PUT - sets a profile option to a value for this session,
6 ** but doesn't save to the database
7 */
8 procedure PUT(NAME in varchar2, VAL in varchar2)
9 is
10 begin
11 fnd_profile.put(name, val);
12 end PUT;
13
14 /*
15 ** DEFINED - returns TRUE if a profile option has been stored
16 */
17 function DEFINED(NAME in varchar2) return boolean
18 is
19 begin
20 return(fnd_profile.defined(name));
21 end DEFINED;
22
23 /*
24 ** GET - gets the value of a profile option
25 */
26 procedure GET(NAME in varchar2, VAL out varchar2)
27 is
28 begin
29 fnd_profile.get(name, val);
30 end GET;
31
32 /*
33 ** VALUE - returns the value of a profile options
34 */
35 function VALUE(NAME in varchar2) return varchar2
36 is
37 begin
38 return(fnd_profile.value(name));
39 end VALUE;
40
41 /*
42 ** VALUE_WNPS - returns the value of a profile option without caching it.
43 **
44 ** The main usage for this routine would be in a SELECT statement
45 ** where VALUE() is not allowed since it writes package state.
46 **
47 ** This routine does the same thing as VALUE(); it returns
48 ** a profile value from the profile cache, or from the database
49 ** if it isn't already in the profile cache already. The only
50 ** difference between this and VALUE() is that this will not
51 ** put the value into the cache if it is not already there, so
52 ** repeated calls to this can be slower because it will have
53 ** to hit the database each time for the profile value.
54 **
55 ** In most cases, however, you can and should use VALUE() instead
56 ** of VALUE_WNPS(), because VALUE() will give better performance.
57 */
58 function VALUE_WNPS(NAME in varchar2) return varchar2
59 is
60 begin
61 return(fnd_profile.value_wnps(name));
62 end VALUE_WNPS;
63
64
65 /*
66 ** SAVE_USER - Sets the value of a profile option permanently
67 ** to the database, at the user level for the current user.
68 ** Also saves in the profile cache for this database session.
69 ** Note that this will not save in the profile caches
70 ** for any other database sessions that may be up, so those
71 ** could potentially be out of sync. This routine will not
72 ** actually commit the changes; the caller must commit.
73 **
74 ** returns: TRUE if successful, FALSE if failure.
75 **
76 */
77 function SAVE_USER(
78 X_NAME in varchar2, /* Profile name you are setting */
79 X_VALUE in varchar2 /* Profile value you are setting */
80 ) return boolean
81 is
82 begin
83 return(fnd_profile.save_user(x_name, x_value));
84 end SAVE_USER;
85
86 /*
87 ** SAVE - sets the value of a profile option permanently
88 ** to the database, at any level. This routine can be used
89 ** at runtime or during patching. This routine will not
90 ** actually commit the changes; the caller must commit.
91 ** ('SITE', 'APPL', 'RESP', or 'USER').
92 ** Examples of use:
93 ** FND_PROFILE.SAVE('P_NAME', 'P_VAL', 'SITE');
94 ** FND_PROFILE.SAVE('P_NAME', 'P_VAL', 'APPL', 321532);
95 ** FND_PROFILE.SAVE('P_NAME', 'P_VAL', 'RESP', 321532, 345234);
96 ** FND_PROFILE.SAVE('P_NAME', 'P_VAL', 'USER', 123321);
97 **
98 ** returns: TRUE if successful, FALSE if failure.
99 **
100 */
101 function SAVE(X_NAME in varchar2, /* Profile name you are setting */
102 X_VALUE in varchar2, /* Profile value you are setting */
103 X_LEVEL_NAME in varchar2,/* Level that youre setting at: */
104 /* 'SITE', 'APPL', 'RESP', or 'USER' */
105 X_LEVEL_VALUE in varchar2 default NULL,
106 /* Level value that you are setting at. */
107 /* e.g. user id for 'USER' level. */
108 /* X_LEVEL_VALUE is not used at site level. */
109 X_LEVEL_VALUE_APP_ID in varchar2 default NULL
110 /* Only used for 'RESP' level; */
111 /* Resp Application_Dd. */
112 ) return boolean
113 is
114 begin
115 return(fnd_profile.save(x_name, x_value, x_level_name, x_level_value,
116 x_level_value_app_id));
117 end SAVE;
118
119 /*
120 ** GET_SPECIFIC - Get profile value for a specific user/resp/appl combo
121 ** Default is user/resp/appl is current login.
122 */
123 procedure GET_SPECIFIC(NAME_Z in varchar2,
124 USER_ID_Z in number default null,
125 RESPONSIBILITY_ID_Z in number default null,
126 APPLICATION_ID_Z in number default null,
127 VAL_Z out varchar2,
128 DEFINED_Z out boolean)
129 is
130 begin
131 fnd_profile.get_specific(name_z, user_id_z, responsibility_id_z,
132 application_id_z, val_z, defined_z);
133 end GET_SPECIFIC;
134
135
136 /*
137 ** VALUE_SPECIFIC - Get profile value for a specific user/resp/appl combo
138 ** Default is user/resp/appl is current login.
139 */
140 function VALUE_SPECIFIC(NAME in varchar2,
141 USER_ID in number default null,
142 RESPONSIBILITY_ID in number default null,
143 APPLICATION_ID in number default null)
144 return varchar2
145 is
146 begin
147 return(fnd_profile.value_specific(name, user_id,
148 responsibility_id, application_id));
149 end VALUE_SPECIFIC;
150
151 end FND_PROFILE_SERVER;