1 Package ben_cpg_shd as
2 /* $Header: becpgrhi.pkh 120.0 2005/05/28 01:13:20 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (group_per_in_ler_id number(15)
10 ,group_pl_id number(15)
11 ,group_oipl_id number(15)
12 ,lf_evt_ocrd_dt date
13 ,bdgt_pop_cd varchar2(30)
14 ,due_dt date
15 ,access_cd varchar2(30)
16 ,approval_cd varchar2(30)
17 ,approval_date date
18 ,approval_comments varchar2(2000)
19 ,submit_cd varchar2(30)
20 ,submit_date date
21 ,submit_comments varchar2(2000)
22 ,dist_bdgt_val number
23 ,ws_bdgt_val number
24 ,rsrv_val number
25 ,dist_bdgt_mn_val number
26 ,dist_bdgt_mx_val number
27 ,dist_bdgt_incr_val number
28 ,ws_bdgt_mn_val number
29 ,ws_bdgt_mx_val number
30 ,ws_bdgt_incr_val number
31 ,rsrv_mn_val number
32 ,rsrv_mx_val number
33 ,rsrv_incr_val number
34 ,dist_bdgt_iss_val number
35 ,ws_bdgt_iss_val number
36 ,dist_bdgt_iss_date date
37 ,ws_bdgt_iss_date date
38 ,ws_bdgt_val_last_upd_date date
39 ,dist_bdgt_val_last_upd_date date
40 ,rsrv_val_last_upd_date date
41 ,ws_bdgt_val_last_upd_by number(15)
42 ,dist_bdgt_val_last_upd_by number(15)
43 ,rsrv_val_last_upd_by number(15)
44 ,object_version_number number(9)
45 );
46 --
47 -- ----------------------------------------------------------------------------
48 -- | Global Definitions - Internal Development Use Only |
49 -- ----------------------------------------------------------------------------
50 --
51 g_old_rec g_rec_type; -- Global record definition
52 -- Global table name
53 g_tab_nam constant varchar2(30) := 'BEN_CWB_PERSON_GROUPS';
54 g_api_dml boolean; -- Global api dml status
55 --
56 -- ----------------------------------------------------------------------------
57 -- |------------------------< return_api_dml_status >-------------------------|
58 -- ----------------------------------------------------------------------------
59 -- {Start Of Comments}
60 --
61 -- Description:
62 -- This function will return the current g_api_dml private global
63 -- boolean status.
64 -- The g_api_dml status determines if at the time of the function
65 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
66 -- is being issued from within an api.
67 -- If the status is TRUE then a dml statement is being issued from
68 -- within this entity api.
69 -- This function is primarily to support database triggers which
70 -- need to maintain the object_version_number for non-supported
71 -- dml statements (i.e. dml statement issued outside of the api layer).
72 --
73 -- Prerequisites:
74 -- None.
75 --
76 -- In Parameters:
77 -- None.
78 --
79 -- Post Success:
80 -- Processing continues.
81 -- If the function returns a TRUE value then, dml is being executed from
82 -- within this api.
83 --
84 -- Post Failure:
85 -- None.
86 --
87 -- Access Status:
88 -- Internal Row Handler Use Only.
89 --
90 -- {End Of Comments}
91 -- ----------------------------------------------------------------------------
92 Function return_api_dml_status Return Boolean;
93 --
94 -- ----------------------------------------------------------------------------
95 -- |---------------------------< constraint_error >---------------------------|
96 -- ----------------------------------------------------------------------------
97 -- {Start Of Comments}
98 --
99 -- Description:
100 -- This procedure is called when a constraint has been violated (i.e.
101 -- The exception hr_api.check_integrity_violated,
102 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
103 -- hr_api.unique_integrity_violated has been raised).
104 -- The exceptions can only be raised as follows:
105 -- 1) A check constraint can only be violated during an INSERT or UPDATE
106 -- dml operation.
107 -- 2) A parent integrity constraint can only be violated during an
108 -- INSERT or UPDATE dml operation.
109 -- 3) A child integrity constraint can only be violated during an
110 -- DELETE dml operation.
111 -- 4) A unique integrity constraint can only be violated during INSERT or
112 -- UPDATE dml operation.
113 --
114 -- Prerequisites:
115 -- 1) Either hr_api.check_integrity_violated,
116 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
117 -- hr_api.unique_integrity_violated has been raised with the subsequent
118 -- stripping of the constraint name from the generated error message
119 -- text.
120 -- 2) Standalone validation test which corresponds with a constraint error.
121 --
122 -- In Parameter:
123 -- p_constraint_name is in upper format and is just the constraint name
124 -- (e.g. not prefixed by brackets, schema owner etc).
125 --
126 -- Post Success:
127 -- Development dependant.
128 --
129 -- Post Failure:
130 -- Developement dependant.
131 --
132 -- Developer Implementation Notes:
133 -- For each constraint being checked the hr system package failure message
134 -- has been generated as a template only. These system error messages should
135 -- be modified as required (i.e. change the system failure message to a user
136 -- friendly defined error message).
137 --
138 -- Access Status:
139 -- Internal Development Use Only.
140 --
141 -- {End Of Comments}
142 -- ----------------------------------------------------------------------------
143 Procedure constraint_error
144 (p_constraint_name in all_constraints.constraint_name%TYPE);
145 --
146 -- ----------------------------------------------------------------------------
147 -- |-----------------------------< api_updating >-----------------------------|
148 -- ----------------------------------------------------------------------------
149 -- {Start Of Comments}
150 --
151 -- Description:
152 -- This function is used to populate the g_old_rec record with the
153 -- current row from the database for the specified primary key
154 -- provided that the primary key exists and is valid and does not
155 -- already match the current g_old_rec. The function will always return
156 -- a TRUE value if the g_old_rec is populated with the current row.
157 -- A FALSE value will be returned if all of the primary key arguments
158 -- are null.
159 --
160 -- Prerequisites:
161 -- None.
162 --
163 -- In Parameters:
164 --
165 -- Post Success:
166 -- A value of TRUE will be returned indiciating that the g_old_rec
167 -- is current.
168 -- A value of FALSE will be returned if all of the primary key arguments
169 -- have a null value (this indicates that the row has not be inserted into
170 -- the Schema), and therefore could never have a corresponding row.
171 --
172 -- Post Failure:
173 -- A failure can only occur under two circumstances:
174 -- 1) The primary key is invalid (i.e. a row does not exist for the
175 -- specified primary key values).
176 -- 2) If an object_version_number exists but is NOT the same as the current
177 -- g_old_rec value.
178 --
179 -- Developer Implementation Notes:
180 -- None.
181 --
182 -- Access Status:
183 -- Internal Development Use Only.
184 --
185 -- {End Of Comments}
186 -- ----------------------------------------------------------------------------
187 Function api_updating
188 (p_group_per_in_ler_id in number
189 ,p_group_pl_id in number
190 ,p_group_oipl_id in number
191 ,p_object_version_number in number
192 ) Return Boolean;
193 --
194 -- ----------------------------------------------------------------------------
195 -- |---------------------------------< lck >----------------------------------|
196 -- ----------------------------------------------------------------------------
197 -- {Start of comments}
198 --
199 -- Description:
200 -- The Lck process has two main functions to perform. Firstly, the row to be
201 -- updated or deleted must be locked. The locking of the row will only be
202 -- successful if the row is not currently locked by another user.
203 -- Secondly, during the locking of the row, the row is selected into
204 -- the g_old_rec data structure which enables the current row values from
205 -- the server to be available to the api.
206 --
207 -- Prerequisites:
208 -- When attempting to call the lock the object version number (if defined)
209 -- is mandatory.
210 --
211 -- In Parameters:
212 -- The arguments to the Lck process are the primary key(s) which uniquely
213 -- identify the row and the object version number of row.
214 --
215 -- Post Success:
216 -- On successful completion of the Lck process the row to be updated or
217 -- deleted will be locked and selected into the global data structure
218 -- g_old_rec.
219 --
220 -- Post Failure:
221 -- The Lck process can fail for three reasons:
222 -- 1) When attempting to lock the row the row could already be locked by
223 -- another user. This will raise the HR_Api.Object_Locked exception.
224 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
225 -- This error is trapped and reported using the message name
226 -- 'HR_7220_INVALID_PRIMARY_KEY'.
227 -- 3) The row although existing in the HR Schema has a different object
228 -- version number than the object version number specified.
229 -- This error is trapped and reported using the message name
230 -- 'HR_7155_OBJECT_INVALID'.
231 --
232 -- Developer Implementation Notes:
233 -- For each primary key and the object version number arguments add a
234 -- call to hr_api.mandatory_arg_error procedure to ensure that these
235 -- argument values are not null.
236 --
237 -- Access Status:
238 -- Internal Development Use Only.
239 --
240 -- {End of comments}
241 -- ----------------------------------------------------------------------------
242 Procedure lck
243 (p_group_per_in_ler_id in number
244 ,p_group_pl_id in number
245 ,p_group_oipl_id in number
246 ,p_object_version_number in number
247 );
248 --
249 -- ----------------------------------------------------------------------------
250 -- |-----------------------------< convert_args >-----------------------------|
251 -- ----------------------------------------------------------------------------
252 -- {Start Of Comments}
253 --
254 -- Description:
255 -- This function is used to turn attribute parameters into the record
256 -- structure parameter g_rec_type.
257 --
258 -- Prerequisites:
259 -- This is a private function and can only be called from the ins or upd
260 -- attribute processes.
261 --
262 -- In Parameters:
263 --
264 -- Post Success:
265 -- A returning record structure will be returned.
266 --
267 -- Post Failure:
268 -- No direct error handling is required within this function. Any possible
269 -- errors within this function will be a PL/SQL value error due to
270 -- conversion of datatypes or data lengths.
271 --
272 -- Developer Implementation Notes:
273 -- None.
274 --
275 -- Access Status:
276 -- Internal Row Handler Use Only.
277 --
278 -- {End Of Comments}
279 -- ----------------------------------------------------------------------------
280 Function convert_args
281 (p_group_per_in_ler_id in number
282 ,p_group_pl_id in number
283 ,p_group_oipl_id in number
284 ,p_lf_evt_ocrd_dt in date
285 ,p_bdgt_pop_cd in varchar2
286 ,p_due_dt in date
287 ,p_access_cd in varchar2
288 ,p_approval_cd in varchar2
289 ,p_approval_date in date
290 ,p_approval_comments in varchar2
291 ,p_submit_cd in varchar2
292 ,p_submit_date in date
293 ,p_submit_comments in varchar2
294 ,p_dist_bdgt_val in number
295 ,p_ws_bdgt_val in number
296 ,p_rsrv_val in number
297 ,p_dist_bdgt_mn_val in number
298 ,p_dist_bdgt_mx_val in number
299 ,p_dist_bdgt_incr_val in number
300 ,p_ws_bdgt_mn_val in number
301 ,p_ws_bdgt_mx_val in number
302 ,p_ws_bdgt_incr_val in number
303 ,p_rsrv_mn_val in number
304 ,p_rsrv_mx_val in number
305 ,p_rsrv_incr_val in number
306 ,p_dist_bdgt_iss_val in number
307 ,p_ws_bdgt_iss_val in number
308 ,p_dist_bdgt_iss_date in date
309 ,p_ws_bdgt_iss_date in date
310 ,p_ws_bdgt_val_last_upd_date in date
311 ,p_dist_bdgt_val_last_upd_date in date
312 ,p_rsrv_val_last_upd_date in date
313 ,p_ws_bdgt_val_last_upd_by in number
314 ,p_dist_bdgt_val_last_upd_by in number
315 ,p_rsrv_val_last_upd_by in number
316 ,p_object_version_number in number
317 )
318 Return g_rec_type;
319 --
320 end ben_cpg_shd;