1 Package per_inc_shd as
2 /* $Header: peincrhi.pkh 120.0 2005/05/31 10:08:42 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (incident_id number(10)
10 ,person_id number(10)
11 ,incident_reference varchar2(30)
12 ,incident_type varchar2(30)
13 ,incident_date date
14 ,incident_time varchar2(30)
15 ,org_notified_date date
16 ,assignment_id number(10)
17 ,location varchar2(30)
18 ,at_work_flag varchar2(30)
19 ,report_date date
20 ,report_time varchar2(30)
21 ,report_method varchar2(30)
22 ,person_reported_by number(10)
23 ,person_reported_to varchar2(2000)
24 ,witness_details varchar2(2000)
25 ,description varchar2(2000)
26 ,injury_type varchar2(30)
27 ,disease_type varchar2(30)
28 ,hazard_type varchar2(30)
29 ,body_part varchar2(2000)
30 ,treatment_received_flag varchar2(30)
31 ,hospital_details varchar2(2000)
32 ,emergency_code varchar2(30)
33 ,hospitalized_flag varchar2(30)
34 ,hospital_address varchar2(240)
35 ,activity_at_time_of_work varchar2(240)
36 ,objects_involved varchar2(240)
37 ,privacy_issue varchar2(30)
38 ,work_start_time varchar2(30)
39 ,date_of_death date
40 ,report_completed_by varchar2(60)
41 ,reporting_person_title varchar2(30)
42 ,reporting_person_phone varchar2(30)
43 ,days_restricted_work number(10)
44 ,days_away_from_work number(10)
45 ,doctor_name varchar2(60)
46 ,compensation_date date
47 ,compensation_currency varchar2(30)
48 ,compensation_amount number
49 ,remedial_hs_action varchar2(2000)
50 ,notified_hsrep_id number(10)
51 ,notified_hsrep_date date
52 ,notified_rep_id number(10)
53 ,notified_rep_date date
54 ,notified_rep_org_id number(15)
55 ,related_incident_id number(10)
56 ,over_time_flag varchar2(30)
57 ,absence_exists_flag varchar2(30)
58 ,attribute_category varchar2(30)
59 ,attribute1 varchar2(150)
60 ,attribute2 varchar2(150)
61 ,attribute3 varchar2(150)
62 ,attribute4 varchar2(150)
63 ,attribute5 varchar2(150)
64 ,attribute6 varchar2(150)
65 ,attribute7 varchar2(150)
66 ,attribute8 varchar2(150)
67 ,attribute9 varchar2(150)
68 ,attribute10 varchar2(150)
69 ,attribute11 varchar2(150)
70 ,attribute12 varchar2(150)
71 ,attribute13 varchar2(150)
72 ,attribute14 varchar2(150)
73 ,attribute15 varchar2(150)
74 ,attribute16 varchar2(150)
75 ,attribute17 varchar2(150)
76 ,attribute18 varchar2(150)
77 ,attribute19 varchar2(150)
78 ,attribute20 varchar2(150)
79 ,attribute21 varchar2(150)
80 ,attribute22 varchar2(150)
81 ,attribute23 varchar2(150)
82 ,attribute24 varchar2(150)
83 ,attribute25 varchar2(150)
84 ,attribute26 varchar2(150)
85 ,attribute27 varchar2(150)
86 ,attribute28 varchar2(150)
87 ,attribute29 varchar2(150)
88 ,attribute30 varchar2(150)
89 ,inc_information_category varchar2(30)
90 ,inc_information1 varchar2(150)
91 ,inc_information2 varchar2(150)
92 ,inc_information3 varchar2(150)
93 ,inc_information4 varchar2(150)
94 ,inc_information5 varchar2(150)
95 ,inc_information6 varchar2(150)
96 ,inc_information7 varchar2(150)
97 ,inc_information8 varchar2(150)
98 ,inc_information9 varchar2(150)
99 ,inc_information10 varchar2(150)
100 ,inc_information11 varchar2(150)
101 ,inc_information12 varchar2(150)
102 ,inc_information13 varchar2(150)
103 ,inc_information14 varchar2(150)
104 ,inc_information15 varchar2(150)
105 ,inc_information16 varchar2(150)
106 ,inc_information17 varchar2(150)
107 ,inc_information18 varchar2(150)
108 ,inc_information19 varchar2(150)
109 ,inc_information20 varchar2(150)
110 ,inc_information21 varchar2(150)
111 ,inc_information22 varchar2(150)
112 ,inc_information23 varchar2(150)
113 ,inc_information24 varchar2(150)
114 ,inc_information25 varchar2(150)
115 ,inc_information26 varchar2(150)
116 ,inc_information27 varchar2(150)
117 ,inc_information28 varchar2(150)
118 ,inc_information29 varchar2(150)
119 ,inc_information30 varchar2(150)
120 ,object_version_number number(9)
121 );
122 --
123 -- ----------------------------------------------------------------------------
124 -- | Global Definitions - Internal Development Use Only |
125 -- ----------------------------------------------------------------------------
126 --
127 g_old_rec g_rec_type; -- Global record definition
128 --
129 -- ----------------------------------------------------------------------------
130 -- |---------------------------< constraint_error >---------------------------|
131 -- ----------------------------------------------------------------------------
132 -- {Start Of Comments}
133 --
134 -- Description:
135 -- This procedure is called when a constraint has been violated (i.e.
136 -- The exception hr_api.check_integrity_violated,
137 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
138 -- hr_api.unique_integrity_violated has been raised).
139 -- The exceptions can only be raised as follows:
140 -- 1) A check constraint can only be violated during an INSERT or UPDATE
141 -- dml operation.
142 -- 2) A parent integrity constraint can only be violated during an
143 -- INSERT or UPDATE dml operation.
144 -- 3) A child integrity constraint can only be violated during an
145 -- DELETE dml operation.
146 -- 4) A unique integrity constraint can only be violated during INSERT or
147 -- UPDATE dml operation.
148 --
149 -- Prerequisites:
150 -- 1) Either hr_api.check_integrity_violated,
151 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
152 -- hr_api.unique_integrity_violated has been raised with the subsequent
153 -- stripping of the constraint name from the generated error message
154 -- text.
155 -- 2) Standalone validation test which corresponds with a constraint error.
156 --
157 -- In Parameter:
158 -- p_constraint_name is in upper format and is just the constraint name
159 -- (e.g. not prefixed by brackets, schema owner etc).
160 --
161 -- Post Success:
162 -- Development dependant.
163 --
164 -- Post Failure:
165 -- Developement dependant.
166 --
167 -- Developer Implementation Notes:
168 -- For each constraint being checked the hr system package failure message
169 -- has been generated as a template only. These system error messages should
170 -- be modified as required (i.e. change the system failure message to a user
171 -- friendly defined error message).
172 --
173 -- Access Status:
174 -- Internal Development Use Only.
175 --
176 -- {End Of Comments}
177 -- ----------------------------------------------------------------------------
178 Procedure constraint_error
179 (p_constraint_name in all_constraints.constraint_name%TYPE);
180 --
181 -- ----------------------------------------------------------------------------
182 -- |-----------------------------< api_updating >-----------------------------|
183 -- ----------------------------------------------------------------------------
184 -- {Start Of Comments}
185 --
186 -- Description:
187 -- This function is used to populate the g_old_rec record with the
188 -- current row from the database for the specified primary key
189 -- provided that the primary key exists and is valid and does not
190 -- already match the current g_old_rec. The function will always return
191 -- a TRUE value if the g_old_rec is populated with the current row.
192 -- A FALSE value will be returned if all of the primary key arguments
193 -- are null.
194 --
195 -- Prerequisites:
196 -- None.
197 --
198 -- In Parameters:
199 --
200 -- Post Success:
201 -- A value of TRUE will be returned indiciating that the g_old_rec
202 -- is current.
203 -- A value of FALSE will be returned if all of the primary key arguments
204 -- have a null value (this indicates that the row has not be inserted into
205 -- the Schema), and therefore could never have a corresponding row.
206 --
207 -- Post Failure:
208 -- A failure can only occur under two circumstances:
209 -- 1) The primary key is invalid (i.e. a row does not exist for the
210 -- specified primary key values).
211 -- 2) If an object_version_number exists but is NOT the same as the current
212 -- g_old_rec value.
213 --
214 -- Developer Implementation Notes:
215 -- None.
216 --
217 -- Access Status:
218 -- Internal Development Use Only.
219 --
220 -- {End Of Comments}
221 -- ----------------------------------------------------------------------------
222 Function api_updating
223 (p_incident_id in number
224 ,p_object_version_number in number
225 ) Return Boolean;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |---------------------------------< lck >----------------------------------|
229 -- ----------------------------------------------------------------------------
230 -- {Start of comments}
231 --
232 -- Description:
233 -- The Lck process has two main functions to perform. Firstly, the row to be
234 -- updated or deleted must be locked. The locking of the row will only be
235 -- successful if the row is not currently locked by another user.
236 -- Secondly, during the locking of the row, the row is selected into
237 -- the g_old_rec data structure which enables the current row values from the
238 -- server to be available to the api.
239 --
240 -- Prerequisites:
241 -- When attempting to call the lock the object version number (if defined)
242 -- is mandatory.
243 --
244 -- In Parameters:
245 -- The arguments to the Lck process are the primary key(s) which uniquely
246 -- identify the row and the object version number of row.
247 --
248 -- Post Success:
249 -- On successful completion of the Lck process the row to be updated or
250 -- deleted will be locked and selected into the global data structure
251 -- g_old_rec.
252 --
253 -- Post Failure:
254 -- The Lck process can fail for three reasons:
255 -- 1) When attempting to lock the row the row could already be locked by
256 -- another user. This will raise the HR_Api.Object_Locked exception.
257 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
258 -- This error is trapped and reported using the message name
259 -- 'HR_7220_INVALID_PRIMARY_KEY'.
260 -- 3) The row although existing in the HR Schema has a different object
261 -- version number than the object version number specified.
262 -- This error is trapped and reported using the message name
263 -- 'HR_7155_OBJECT_INVALID'.
264 --
265 -- Developer Implementation Notes:
266 -- For each primary key and the object version number arguments add a
267 -- call to hr_api.mandatory_arg_error procedure to ensure that these
268 -- argument values are not null.
269 --
270 -- Access Status:
271 -- Internal Development Use Only.
272 --
273 -- {End of comments}
274 -- ----------------------------------------------------------------------------
275 Procedure lck
276 (p_incident_id in number
277 ,p_object_version_number in number
278 );
279 --
280 -- ----------------------------------------------------------------------------
281 -- |-----------------------------< convert_args >-----------------------------|
282 -- ----------------------------------------------------------------------------
283 -- {Start Of Comments}
284 --
285 -- Description:
286 -- This function is used to turn attribute parameters into the record
287 -- structure parameter g_rec_type.
288 --
289 -- Prerequisites:
290 -- This is a private function and can only be called from the ins or upd
291 -- attribute processes.
292 --
293 -- In Parameters:
294 --
295 -- Post Success:
296 -- A returning record structure will be returned.
297 --
298 -- Post Failure:
299 -- No direct error handling is required within this function. Any possible
300 -- errors within this function will be a PL/SQL value error due to conversion
301 -- of datatypes or data lengths.
302 --
303 -- Developer Implementation Notes:
304 -- None.
305 --
306 -- Access Status:
307 -- Internal Row Handler Use Only.
308 --
309 -- {End Of Comments}
310 -- ----------------------------------------------------------------------------
311 Function convert_args
312 (p_incident_id in number
313 ,p_person_id in number
314 ,p_incident_reference in varchar2
315 ,p_incident_type in varchar2
316 ,p_incident_date in date
317 ,p_incident_time in varchar2
318 ,p_org_notified_date in date
319 ,p_assignment_id in number
320 ,p_location in varchar2
321 ,p_at_work_flag in varchar2
322 ,p_report_date in date
323 ,p_report_time in varchar2
324 ,p_report_method in varchar2
325 ,p_person_reported_by in number
326 ,p_person_reported_to in varchar2
327 ,p_witness_details in varchar2
328 ,p_description in varchar2
329 ,p_injury_type in varchar2
330 ,p_disease_type in varchar2
331 ,p_hazard_type in varchar2
332 ,p_body_part in varchar2
333 ,p_treatment_received_flag in varchar2
334 ,p_hospital_details in varchar2
335 ,p_emergency_code in varchar2
336 ,p_hospitalized_flag in varchar2
337 ,p_hospital_address in varchar2
338 ,p_activity_at_time_of_work in varchar2
339 ,p_objects_involved in varchar2
340 ,p_privacy_issue in varchar2
341 ,p_work_start_time in varchar2
342 ,p_date_of_death in date
343 ,p_report_completed_by in varchar2
344 ,p_reporting_person_title in varchar2
345 ,p_reporting_person_phone in varchar2
346 ,p_days_restricted_work in number
347 ,p_days_away_from_work in number
348 ,p_doctor_name in varchar2
349 ,p_compensation_date in date
353 ,p_notified_hsrep_id in number
350 ,p_compensation_currency in varchar2
351 ,p_compensation_amount in number
352 ,p_remedial_hs_action in varchar2
354 ,p_notified_hsrep_date in date
355 ,p_notified_rep_id in number
356 ,p_notified_rep_date in date
357 ,p_notified_rep_org_id in number
358 ,p_related_incident_id in number
359 ,p_over_time_flag in varchar2
360 ,p_absence_exists_flag in varchar2
361 ,p_attribute_category in varchar2
362 ,p_attribute1 in varchar2
363 ,p_attribute2 in varchar2
364 ,p_attribute3 in varchar2
365 ,p_attribute4 in varchar2
366 ,p_attribute5 in varchar2
367 ,p_attribute6 in varchar2
368 ,p_attribute7 in varchar2
369 ,p_attribute8 in varchar2
370 ,p_attribute9 in varchar2
371 ,p_attribute10 in varchar2
372 ,p_attribute11 in varchar2
373 ,p_attribute12 in varchar2
374 ,p_attribute13 in varchar2
375 ,p_attribute14 in varchar2
376 ,p_attribute15 in varchar2
377 ,p_attribute16 in varchar2
378 ,p_attribute17 in varchar2
379 ,p_attribute18 in varchar2
380 ,p_attribute19 in varchar2
381 ,p_attribute20 in varchar2
382 ,p_attribute21 in varchar2
383 ,p_attribute22 in varchar2
384 ,p_attribute23 in varchar2
385 ,p_attribute24 in varchar2
386 ,p_attribute25 in varchar2
387 ,p_attribute26 in varchar2
388 ,p_attribute27 in varchar2
389 ,p_attribute28 in varchar2
390 ,p_attribute29 in varchar2
391 ,p_attribute30 in varchar2
392 ,p_inc_information_category in varchar2
393 ,p_inc_information1 in varchar2
394 ,p_inc_information2 in varchar2
395 ,p_inc_information3 in varchar2
396 ,p_inc_information4 in varchar2
397 ,p_inc_information5 in varchar2
398 ,p_inc_information6 in varchar2
399 ,p_inc_information7 in varchar2
400 ,p_inc_information8 in varchar2
401 ,p_inc_information9 in varchar2
402 ,p_inc_information10 in varchar2
403 ,p_inc_information11 in varchar2
404 ,p_inc_information12 in varchar2
405 ,p_inc_information13 in varchar2
406 ,p_inc_information14 in varchar2
407 ,p_inc_information15 in varchar2
408 ,p_inc_information16 in varchar2
409 ,p_inc_information17 in varchar2
410 ,p_inc_information18 in varchar2
411 ,p_inc_information19 in varchar2
412 ,p_inc_information20 in varchar2
413 ,p_inc_information21 in varchar2
414 ,p_inc_information22 in varchar2
415 ,p_inc_information23 in varchar2
416 ,p_inc_information24 in varchar2
417 ,p_inc_information25 in varchar2
418 ,p_inc_information26 in varchar2
419 ,p_inc_information27 in varchar2
420 ,p_inc_information28 in varchar2
421 ,p_inc_information29 in varchar2
422 ,p_inc_information30 in varchar2
423 ,p_object_version_number in number
424 )
425 Return g_rec_type;
426 --
427 end per_inc_shd;