1 Package per_bil_shd AUTHID CURRENT_USER as
2 /* $Header: pebilrhi.pkh 115.7 2003/04/10 09:18:05 jheer noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (
10 type varchar2(30),
11 business_group_id number,
12 object_version_number number,
13 id_value number,
14 fk_value1 number,
15 fk_value2 number,
16 fk_value3 number,
17 text_value1 varchar2(240),
18 text_value2 varchar2(240),
19 text_value3 varchar2(240),
20 text_value4 varchar2(240),
21 text_value5 varchar2(240),
22 text_value6 varchar2(4000),
23 text_value7 varchar2(240),
24 num_value1 number,
25 num_value2 number,
26 num_value3 number,
27 date_value1 date,
28 date_value2 date,
29 date_value3 date,
30 created_by number
31 );
32 --
33 -- ----------------------------------------------------------------------------
34 -- | Global Definitions - Internal Development Use Only |
35 -- ----------------------------------------------------------------------------
36 --
37 g_old_rec g_rec_type; -- Global record definition
38 g_api_dml boolean; -- Global api dml status
39 --
40 -- ----------------------------------------------------------------------------
41 -- |------------------------< return_api_dml_status >-------------------------|
42 -- ----------------------------------------------------------------------------
43 -- {Start Of Comments}
44 --
45 -- Description:
46 -- This function will return the current g_api_dml private global
47 -- boolean status.
48 -- The g_api_dml status determines if at the time of the function
49 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
50 -- is being issued from within an api.
51 -- If the status is TRUE then a dml statement is being issued from
52 -- within this entity api.
53 -- This function is primarily to support database triggers which
54 -- need to maintain the object_version_number for non-supported
55 -- dml statements (i.e. dml statement issued outside of the api layer).
56 --
57 -- Prerequisites:
58 -- None.
59 --
60 -- In Parameters:
61 -- None.
62 --
63 -- Post Success:
64 -- Processing continues.
65 -- If the function returns a TRUE value then, dml is being executed from
66 -- within this api.
67 --
68 -- Post Failure:
69 -- None.
70 --
71 -- Access Status:
72 -- Internal Row Handler Use Only.
73 --
74 -- {End Of Comments}
75 -- ----------------------------------------------------------------------------
76 Function return_api_dml_status Return Boolean;
77 --
78 -- ----------------------------------------------------------------------------
79 -- |---------------------------< constraint_error >---------------------------|
80 -- ----------------------------------------------------------------------------
81 -- {Start Of Comments}
82 --
83 -- Description:
84 -- This procedure is called when a constraint has been violated (i.e.
85 -- The exception hr_api.check_integrity_violated,
86 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
87 -- hr_api.unique_integrity_violated has been raised).
88 -- The exceptions can only be raised as follows:
89 -- 1) A check constraint can only be violated during an INSERT or UPDATE
90 -- dml operation.
91 -- 2) A parent integrity constraint can only be violated during an
92 -- INSERT or UPDATE dml operation.
93 -- 3) A child integrity constraint can only be violated during an
94 -- DELETE dml operation.
95 -- 4) A unique integrity constraint can only be violated during INSERT or
96 -- UPDATE dml operation.
97 --
98 -- Prerequisites:
99 -- 1) Either hr_api.check_integrity_violated,
100 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
101 -- hr_api.unique_integrity_violated has been raised with the subsequent
102 -- stripping of the constraint name from the generated error message
103 -- text.
104 -- 2) Standalone validation test which corresponds with a constraint error.
105 --
106 -- In Parameter:
107 -- p_constraint_name is in upper format and is just the constraint name
108 -- (e.g. not prefixed by brackets, schema owner etc).
109 --
110 -- Post Success:
111 -- Development dependant.
112 --
113 -- Post Failure:
114 -- Developement dependant.
115 --
116 -- Developer Implementation Notes:
117 -- For each constraint being checked the hr system package failure message
118 -- has been generated as a template only. These system error messages should
119 -- be modified as required (i.e. change the system failure message to a user
120 -- friendly defined error message).
121 --
122 -- Access Status:
123 -- Internal Development Use Only.
124 --
125 -- {End Of Comments}
126 -- ----------------------------------------------------------------------------
127 Procedure constraint_error
128 (p_constraint_name in all_constraints.constraint_name%TYPE);
129 --
130 -- ----------------------------------------------------------------------------
131 -- |-----------------------------< api_updating >-----------------------------|
132 -- ----------------------------------------------------------------------------
133 -- {Start Of Comments}
134 --
135 -- Description:
136 -- This function is used to populate the g_old_rec record with the
137 -- current row from the database for the specified primary key
138 -- provided that the primary key exists and is valid and does not
139 -- already match the current g_old_rec. The function will always return
140 -- a TRUE value if the g_old_rec is populated with the current row.
141 -- A FALSE value will be returned if all of the primary key arguments
142 -- are null.
143 --
144 -- Prerequisites:
145 -- None.
146 --
147 -- In Parameters:
148 --
149 -- Post Success:
150 -- A value of TRUE will be returned indiciating that the g_old_rec
151 -- is current.
152 -- A value of FALSE will be returned if all of the primary key arguments
153 -- have a null value (this indicates that the row has not be inserted into
154 -- the Schema), and therefore could never have a corresponding row.
155 --
156 -- Post Failure:
157 -- A failure can only occur under two circumstances:
158 -- 1) The primary key is invalid (i.e. a row does not exist for the
159 -- specified primary key values).
160 -- 2) If an object_version_number exists but is NOT the same as the current
161 -- g_old_rec value.
162 --
163 -- Developer Implementation Notes:
164 -- None.
165 --
166 -- Access Status:
167 -- Internal Development Use Only.
168 --
169 -- {End Of Comments}
170 -- ----------------------------------------------------------------------------
171 Function api_updating
172 (
173 p_id_value in number,
174 p_object_version_number in number
175 ) Return Boolean;
176 --
177 -- ----------------------------------------------------------------------------
178 -- |---------------------------------< lck >----------------------------------|
179 -- ----------------------------------------------------------------------------
180 -- {Start Of Comments}
181 --
182 -- Description:
183 -- The Lck process has two main functions to perform. Firstly, the row to be
184 -- updated or deleted must be locked. The locking of the row will only be
185 -- successful if the row is not currently locked by another user.
186 -- Secondly, during the locking of the row, the row is selected into
187 -- the g_old_rec data structure which enables the current row values from the
188 -- server to be available to the api.
189 --
190 -- Prerequisites:
191 -- When attempting to call the lock the object version number (if defined)
192 -- is mandatory.
193 --
194 -- In Parameters:
195 -- The arguments to the Lck process are the primary key(s) which uniquely
196 -- identify the row and the object version number of row.
197 --
198 -- Post Success:
199 -- On successful completion of the Lck process the row to be updated or
200 -- deleted will be locked and selected into the global data structure
201 -- g_old_rec.
202 --
203 -- Post Failure:
204 -- The Lck process can fail for three reasons:
205 -- 1) When attempting to lock the row the row could already be locked by
206 -- another user. This will raise the HR_Api.Object_Locked exception.
207 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
208 -- This error is trapped and reported using the message name
209 -- 'HR_7220_INVALID_PRIMARY_KEY'.
210 -- 3) The row although existing in the HR Schema has a different object
211 -- version number than the object version number specified.
212 -- This error is trapped and reported using the message name
213 -- 'HR_7155_OBJECT_INVALID'.
214 --
215 -- Developer Implementation Notes:
216 -- For each primary key and the object version number arguments add a
217 -- call to hr_api.mandatory_arg_error procedure to ensure that these
218 -- argument values are not null.
219 --
220 -- Access Status:
221 -- Internal Development Use Only.
222 --
223 -- {End Of Comments}
224 -- ----------------------------------------------------------------------------
225 Procedure lck
226 (
227 p_id_value in number,
228 p_object_version_number in number
229 );
230 --
231 -- ----------------------------------------------------------------------------
232 -- |-----------------------------< convert_args >-----------------------------|
233 -- ----------------------------------------------------------------------------
234 -- {Start Of Comments}
235 --
236 -- Description:
237 -- This function is used to turn attribute parameters into the record
238 -- structure parameter g_rec_type.
239 --
240 -- Prerequisites:
241 -- This is a private function and can only be called from the ins or upd
242 -- attribute processes.
243 --
244 -- In Parameters:
245 --
246 -- Post Success:
247 -- A returning record structure will be returned.
248 --
249 -- Post Failure:
250 -- No direct error handling is required within this function. Any possible
251 -- errors within this function will be a PL/SQL value error due to conversion
252 -- of datatypes or data lengths.
253 --
254 -- Developer Implementation Notes:
255 -- None.
256 --
257 -- Access Status:
258 -- Internal Row Handler Use Only.
259 --
260 -- {End Of Comments}
261 -- ----------------------------------------------------------------------------
262 Function convert_args
263 (
264 p_type in varchar2,
265 p_business_group_id in number,
266 p_object_version_number in number,
267 p_id_value in number,
268 p_fk_value1 in number,
269 p_fk_value2 in number,
270 p_fk_value3 in number,
271 p_text_value1 in varchar2,
272 p_text_value2 in varchar2,
273 p_text_value3 in varchar2,
274 p_text_value4 in varchar2,
275 p_text_value5 in varchar2,
276 p_text_value6 in varchar2,
277 p_text_value7 in varchar2,
278 p_num_value1 in number,
279 p_num_value2 in number,
280 p_num_value3 in number,
281 p_date_value1 in date,
282 p_date_value2 in date,
283 p_date_value3 in date
284 )
285 Return g_rec_type;
286 --
287 -- Checks the row to see if it is unique.
288 --
289 Function row_exist(p_rec in per_bil_shd.g_rec_type) return boolean;
290 --
291 -- Checks to see if the lookup exists
292 --
293 Procedure lookup_exists (p_type in varchar2,
294 p_code in varchar2);
295 --
296 -- Checks the row to see if the sequence number on hr_summary_item_type_usage is unique.
297 --
298 Function sequence_exist (p_rec in per_bil_shd.g_rec_type) return boolean;
299 --
300 -- -----------------------------------------------------------------------
301 -- | procedure check_restriction_sql |
302 -- | This procedures validates the restriction_sql of a restriction type |
303 -- -----------------------------------------------------------------------
304 procedure check_restriction_sql (p_stmt in out nocopy varchar2
305 ,p_business_group_id in number);
306 --
307 -- -------------------------------------------------------------
308 -- | procedure valid_value |
309 -- | If a restriction value belongs to a restriction with an |
310 -- | attached LOV then this procedure validates the |
311 -- | restriction value according to the LOV. |
312 -- -------------------------------------------------------------
313 Procedure valid_value (p_rec in per_bil_shd.g_rec_type);
314 --
315 -- ----------------------------------------------------------------------------
316 -- | < get_restriction_meaning > |
317 -- | Added for bug 2348887 to enable meanings to be shown in GSP form |
318 -- ----------------------------------------------------------------------------
319 function get_restriction_meaning(p_valid_restriction_id in number
320 ,p_value in varchar2)return varchar2;
321 --
322 -- --------------------------------------------------------------------------
323 -- | Function parent_found |
324 -- | Checks to see if parent record exists |
325 -- --------------------------------------------------------------------------
326 Function parent_found (p_rec in per_bil_shd.g_rec_type) return boolean;
327 --
328 -- Checks to see if date is in correct format
329 --
330 Function chk_date_valid (p_rec in per_bil_shd.g_rec_type) return boolean;
331 --
332 end per_bil_shd;