1 Package per_est_shd AUTHID CURRENT_USER as
2 /* $Header: peestrhi.pkh 120.0.12010000.1 2008/07/28 04:39:11 appldev ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (
10 establishment_id number(9),
11 name varchar2(160),
12 location varchar2(255),
13 attribute_category varchar2(30),
14 attribute1 varchar2(150),
15 attribute2 varchar2(150),
16 attribute3 varchar2(150),
17 attribute4 varchar2(150),
18 attribute5 varchar2(150),
19 attribute6 varchar2(150),
20 attribute7 varchar2(150),
21 attribute8 varchar2(150),
22 attribute9 varchar2(150),
23 attribute10 varchar2(150),
24 attribute11 varchar2(150),
25 attribute12 varchar2(150),
26 attribute13 varchar2(150),
27 attribute14 varchar2(150),
28 attribute15 varchar2(150),
29 attribute16 varchar2(150),
30 attribute17 varchar2(150),
31 attribute18 varchar2(150),
32 attribute19 varchar2(150),
33 attribute20 varchar2(150),
34 est_information_category varchar2(30),
35 est_information1 varchar2(150),
36 est_information2 varchar2(150),
37 est_information3 varchar2(150),
38 est_information4 varchar2(150),
39 est_information5 varchar2(150),
40 est_information6 varchar2(150),
41 est_information7 varchar2(150),
42 est_information8 varchar2(150),
43 est_information9 varchar2(150),
44 est_information10 varchar2(150),
45 est_information11 varchar2(150),
46 est_information12 varchar2(150),
47 est_information13 varchar2(150),
48 est_information14 varchar2(150),
49 est_information15 varchar2(150),
50 est_information16 varchar2(150),
51 est_information17 varchar2(150),
52 est_information18 varchar2(150),
53 est_information19 varchar2(150),
54 est_information20 varchar2(150),
55 object_version_number number(9)
56 );
57 --
58 -- ----------------------------------------------------------------------------
59 -- | Global Definitions - Internal Development Use Only |
60 -- ----------------------------------------------------------------------------
61 --
62 g_old_rec g_rec_type; -- Global record definition
63 g_api_dml boolean; -- Global api dml status
64 --
65 -- ----------------------------------------------------------------------------
66 -- |------------------------< return_api_dml_status >-------------------------|
67 -- ----------------------------------------------------------------------------
68 -- {Start Of Comments}
69 --
70 -- Description:
71 -- This function will return the current g_api_dml private global
72 -- boolean status.
73 -- The g_api_dml status determines if at the time of the function
74 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
75 -- is being issued from within an api.
76 -- If the status is TRUE then a dml statement is being issued from
77 -- within this entity api.
78 -- This function is primarily to support database triggers which
79 -- need to maintain the object_version_number for non-supported
80 -- dml statements (i.e. dml statement issued outside of the api layer).
81 --
82 -- Pre Conditions:
83 -- None.
84 --
85 -- In Parameters:
86 -- None.
87 --
88 -- Post Success:
89 -- Processing continues.
90 -- If the function returns a TRUE value then, dml is being executed from
91 -- within this api.
92 --
93 -- Post Failure:
94 -- None.
95 --
96 -- Access Status:
97 -- Internal Table Handler Use Only.
98 --
99 -- {End Of Comments}
100 -- ----------------------------------------------------------------------------
101 Function return_api_dml_status Return Boolean;
102 --
103 -- ----------------------------------------------------------------------------
104 -- |---------------------------< constraint_error >---------------------------|
105 -- ----------------------------------------------------------------------------
106 -- {Start Of Comments}
107 --
108 -- Description:
109 -- This procedure is called when a constraint has been violated (i.e.
110 -- The exception hr_api.check_integrity_violated,
111 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
112 -- hr_api.unique_integrity_violated has been raised).
113 -- The exceptions can only be raised as follows:
114 -- 1) A check constraint can only be violated during an INSERT or UPDATE
115 -- dml operation.
116 -- 2) A parent integrity constraint can only be violated during an
117 -- INSERT or UPDATE dml operation.
118 -- 3) A child integrity constraint can only be violated during an
119 -- DELETE dml operation.
120 -- 4) A unique integrity constraint can only be violated during INSERT or
121 -- UPDATE dml operation.
122 --
123 -- Pre Conditions:
124 -- 1) Either hr_api.check_integrity_violated,
125 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
126 -- hr_api.unique_integrity_violated has been raised with the subsequent
127 -- stripping of the constraint name from the generated error message
128 -- text.
129 -- 2) Standalone validation test which corresponds with a constraint error.
130 --
131 -- In Parameter:
132 -- p_constraint_name is in upper format and is just the constraint name
133 -- (e.g. not prefixed by brackets, schema owner etc).
134 --
135 -- Post Success:
136 -- Development dependant.
137 --
138 -- Post Failure:
139 -- Developement dependant.
140 --
141 -- Developer Implementation Notes:
142 -- For each constraint being checked the hr system package failure message
143 -- has been generated as a template only. These system error messages should
144 -- be modified as required (i.e. change the system failure message to a user
145 -- friendly defined error message).
146 --
147 -- Access Status:
148 -- Internal Development Use Only.
149 --
150 -- {End Of Comments}
151 -- ----------------------------------------------------------------------------
152 Procedure constraint_error
153 (p_constraint_name in all_constraints.constraint_name%TYPE);
154 --
155 -- ----------------------------------------------------------------------------
156 -- |-----------------------------< api_updating >-----------------------------|
157 -- ----------------------------------------------------------------------------
158 -- {Start Of Comments}
159 --
160 -- Description:
161 -- This function is used to populate the g_old_rec record with the
162 -- current row from the database for the specified primary key
163 -- provided that the primary key exists and is valid and does not
164 -- already match the current g_old_rec. The function will always return
165 -- a TRUE value if the g_old_rec is populated with the current row.
166 -- A FALSE value will be returned if all of the primary key arguments
167 -- are null.
168 --
169 -- Pre Conditions:
170 -- None.
171 --
172 -- In Parameters:
173 --
174 -- Post Success:
175 -- A value of TRUE will be returned indiciating that the g_old_rec
176 -- is current.
177 -- A value of FALSE will be returned if all of the primary key arguments
178 -- have a null value (this indicates that the row has not be inserted into
179 -- the Schema), and therefore could never have a corresponding row.
180 --
181 -- Post Failure:
182 -- A failure can only occur under two circumstances:
183 -- 1) The primary key is invalid (i.e. a row does not exist for the
184 -- specified primary key values).
185 -- 2) If an object_version_number exists but is NOT the same as the current
186 -- g_old_rec value.
187 --
188 -- Developer Implementation Notes:
189 -- None.
190 --
191 -- Access Status:
192 -- Internal Development Use Only.
193 --
194 -- {End Of Comments}
195 -- ----------------------------------------------------------------------------
196 Function api_updating
197 (
198 p_establishment_id in number,
199 p_object_version_number in number
200 ) Return Boolean;
201 --
202 -- ----------------------------------------------------------------------------
203 -- |---------------------------------< lck >----------------------------------|
204 -- ----------------------------------------------------------------------------
205 -- {Start Of Comments}
206 --
207 -- Description:
208 -- The Lck process has two main functions to perform. Firstly, the row to be
209 -- updated or deleted must be locked. The locking of the row will only be
210 -- successful if the row is not currently locked by another user.
211 -- Secondly, during the locking of the row, the row is selected into
212 -- the g_old_rec data structure which enables the current row values from the
213 -- server to be available to the api.
214 --
215 -- Pre Conditions:
216 -- When attempting to call the lock the object version number (if defined)
217 -- is mandatory.
218 --
219 -- In Parameters:
220 -- The arguments to the Lck process are the primary key(s) which uniquely
221 -- identify the row and the object version number of row.
222 --
223 -- Post Success:
224 -- On successful completion of the Lck process the row to be updated or
225 -- deleted will be locked and selected into the global data structure
226 -- g_old_rec.
227 --
228 -- Post Failure:
229 -- The Lck process can fail for three reasons:
230 -- 1) When attempting to lock the row the row could already be locked by
231 -- another user. This will raise the HR_Api.Object_Locked exception.
232 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
233 -- This error is trapped and reported using the message name
234 -- 'HR_7220_INVALID_PRIMARY_KEY'.
235 -- 3) The row although existing in the HR Schema has a different object
236 -- version number than the object version number specified.
237 -- This error is trapped and reported using the message name
238 -- 'HR_7155_OBJECT_INVALID'.
239 --
240 -- Developer Implementation Notes:
241 -- For each primary key and the object version number arguments add a
242 -- call to hr_api.mandatory_arg_error procedure to ensure that these
243 -- argument values are not null.
244 --
245 -- Access Status:
246 -- Internal Development Use Only.
247 --
248 -- {End Of Comments}
249 -- ----------------------------------------------------------------------------
250 Procedure lck
251 (
252 p_establishment_id in number,
253 p_object_version_number in number
254 );
255 --
256 -- ----------------------------------------------------------------------------
257 -- |-----------------------------< convert_args >-----------------------------|
258 -- ----------------------------------------------------------------------------
259 -- {Start Of Comments}
260 --
261 -- Description:
262 -- This function is used to turn attribute parameters into the record
263 -- structure parameter g_rec_type.
264 --
265 -- Pre Conditions:
266 -- This is a private function and can only be called from the ins or upd
267 -- attribute processes.
268 --
269 -- In Parameters:
270 --
271 -- Post Success:
272 -- A returning record structure will be returned.
273 --
274 -- Post Failure:
275 -- No direct error handling is required within this function. Any possible
276 -- errors within this function will be a PL/SQL value error due to conversion
277 -- of datatypes or data lengths.
278 --
279 -- Developer Implementation Notes:
280 -- None.
281 --
282 -- Access Status:
283 -- Internal Table Handler Use Only.
284 --
285 -- {End Of Comments}
286 -- ----------------------------------------------------------------------------
287 Function convert_args
288 (
289 p_establishment_id in number,
290 p_name in varchar2,
291 p_location in varchar2,
292 p_attribute_category in varchar2,
293 p_attribute1 in varchar2,
294 p_attribute2 in varchar2,
295 p_attribute3 in varchar2,
296 p_attribute4 in varchar2,
297 p_attribute5 in varchar2,
298 p_attribute6 in varchar2,
299 p_attribute7 in varchar2,
300 p_attribute8 in varchar2,
301 p_attribute9 in varchar2,
302 p_attribute10 in varchar2,
303 p_attribute11 in varchar2,
304 p_attribute12 in varchar2,
305 p_attribute13 in varchar2,
306 p_attribute14 in varchar2,
307 p_attribute15 in varchar2,
308 p_attribute16 in varchar2,
309 p_attribute17 in varchar2,
310 p_attribute18 in varchar2,
311 p_attribute19 in varchar2,
312 p_attribute20 in varchar2,
313 p_est_information_category in varchar2,
314 p_est_information1 in varchar2,
315 p_est_information2 in varchar2,
316 p_est_information3 in varchar2,
317 p_est_information4 in varchar2,
318 p_est_information5 in varchar2,
319 p_est_information6 in varchar2,
320 p_est_information7 in varchar2,
321 p_est_information8 in varchar2,
322 p_est_information9 in varchar2,
323 p_est_information10 in varchar2,
324 p_est_information11 in varchar2,
325 p_est_information12 in varchar2,
326 p_est_information13 in varchar2,
327 p_est_information14 in varchar2,
328 p_est_information15 in varchar2,
329 p_est_information16 in varchar2,
330 p_est_information17 in varchar2,
331 p_est_information18 in varchar2,
332 p_est_information19 in varchar2,
333 p_est_information20 in varchar2,
334 p_object_version_number in number
335 )
336 Return g_rec_type;
337 --
338 end per_est_shd;