1 Package per_kad_shd AUTHID CURRENT_USER as
2 /* $Header: pekadrhi.pkh 115.4 2002/12/06 11:27:33 pkakar ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (
10 address_id number(15),
11 business_group_id number(15),
12 person_id per_addresses.person_id%TYPE,
13 date_from date,
14 primary_flag varchar2(30),
15 style varchar2(30),
16 address_line1 varchar2(60),
17 address_line2 varchar2(60),
18 address_line3 varchar2(60),
19 address_type varchar2(30),
20 comments long,
21 country varchar2(60),
22 date_to date,
23 postal_code varchar2(30),
24 region_1 varchar2(70),
25 region_2 varchar2(70),
26 region_3 varchar2(70),
27 telephone_number_1 varchar2(60),
28 telephone_number_2 varchar2(60),
29 telephone_number_3 varchar2(60),
30 town_or_city varchar2(30),
31 request_id number(15),
32 program_application_id number(15),
33 program_id number(15),
34 program_update_date date,
35 addr_attribute_category varchar2(30),
36 addr_attribute1 varchar2(150),
37 addr_attribute2 varchar2(150),
38 addr_attribute3 varchar2(150),
39 addr_attribute4 varchar2(150),
40 addr_attribute5 varchar2(150),
41 addr_attribute6 varchar2(150),
42 addr_attribute7 varchar2(150),
43 addr_attribute8 varchar2(150),
44 addr_attribute9 varchar2(150),
45 addr_attribute10 varchar2(150),
46 addr_attribute11 varchar2(150),
47 addr_attribute12 varchar2(150),
48 addr_attribute13 varchar2(150),
49 addr_attribute14 varchar2(150),
50 addr_attribute15 varchar2(150),
51 addr_attribute16 varchar2(150),
52 addr_attribute17 varchar2(150),
53 addr_attribute18 varchar2(150),
54 addr_attribute19 varchar2(150),
55 addr_attribute20 varchar2(150),
56 object_version_number number(9)
57 );
58 --
59 -- ----------------------------------------------------------------------------
60 -- | Global Definitions - Internal Table Handler Use Only |
61 -- ----------------------------------------------------------------------------
62 --
63 g_old_rec g_rec_type; -- Global record definition
64 g_api_dml boolean; -- Global api dml status
65 --
66 -- ----------------------------------------------------------------------------
67 -- |------------------------< return_api_dml_status >-------------------------|
68 -- ----------------------------------------------------------------------------
69 -- {Start Of Comments}
70 --
71 -- Description:
72 -- This function will return the current g_api_dml private global
73 -- boolean status.
74 -- The g_api_dml status determines if at the time of the function
75 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
76 -- is being issued from within an api.
77 -- If the status is TRUE then a dml statement is being issued from
78 -- within this entity api.
79 -- This function is primarily to support database triggers which
80 -- need to maintain the object_version_number for non-supported
81 -- dml statements (i.e. dml statement issued outside of the api layer).
82 --
83 -- Pre Conditions:
84 -- None.
85 --
86 -- In Arguments:
87 -- None.
88 --
89 -- Post Success:
90 -- Processing continues.
91 -- If the function returns a TRUE value then, dml is being executed from
92 -- within this api.
93 --
94 -- Post Failure:
95 -- None.
96 --
97 -- Access Status:
98 -- Internal Table Handler Use Only.
99 --
100 -- {End Of Comments}
101 -- ----------------------------------------------------------------------------
102 Function return_api_dml_status Return Boolean;
103 --
104 -- ----------------------------------------------------------------------------
105 -- |---------------------------< constraint_error >---------------------------|
106 -- ----------------------------------------------------------------------------
107 -- {Start Of Comments}
108 --
109 -- Description:
110 -- This procedure is called when a constraint has been violated (i.e.
111 -- The exception hr_api.check_integrity_violated,
112 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
113 -- hr_api.unique_integrity_violated has been raised).
114 -- The exceptions can only be raised as follows:
115 -- 1) A check constraint can only be violated during an INSERT or UPDATE
116 -- dml operation.
117 -- 2) A parent integrity constraint can only be violated during an
118 -- INSERT or UPDATE dml operation.
119 -- 3) A child integrity constraint can only be violated during an
120 -- DELETE dml operation.
121 -- 4) A unique integrity constraint can only be violated during INSERT or
122 -- UPDATE dml operation.
123 --
124 -- Pre Conditions:
125 -- 1) Either hr_api.check_integrity_violated,
126 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
127 -- hr_api.unique_integrity_violated has been raised with the subsequent
128 -- stripping of the constraint name from the generated error message
129 -- text.
130 -- 2) Standalone validation test which correspond with a constraint error.
131 --
132 -- In Arguments:
133 -- p_constraint_name is in upper format and is just the constraint name
134 -- (e.g. not prefixed by brackets, schema owner etc).
135 --
136 -- Post Success:
137 -- Development dependant.
138 --
139 -- Post Failure:
140 -- Developement dependant.
141 --
142 -- Developer Implementation Notes:
143 -- For each constraint being checked the hr system package failure message
144 -- has been generated as a template only. These system error messages should
145 -- be modified as required (i.e. change the system failure message to a user
146 -- friendly defined error message).
147 --
148 -- Access Status:
149 -- Internal Development Use Only.
150 --
151 -- {End Of Comments}
152 -- ----------------------------------------------------------------------------
153 Procedure constraint_error
154 (p_constraint_name in all_constraints.constraint_name%TYPE);
155 --
156 -- ----------------------------------------------------------------------------
157 -- |-----------------------------< api_updating >-----------------------------|
158 -- ----------------------------------------------------------------------------
159 -- {Start Of Comments}
160 --
161 -- Description:
162 -- This function is used to populate the g_old_rec record with the
163 -- current row from the database for the specified primary key
164 -- provided that the primary key exists and is valid and does not
165 -- already match the current g_old_rec. The function will always return
166 -- a TRUE value if the g_old_rec is populated with the current row.
167 -- A FALSE value will be returned if all of the primary key arguments
168 -- are null.
169 --
170 -- Pre Conditions:
171 -- None.
172 --
173 -- In Arguments:
174 --
175 -- Post Success:
176 -- A value of TRUE will be returned indiciating that the g_old_rec
177 -- is current.
178 -- A value of FALSE will be returned if all of the primary key arguments
179 -- have a null value (this indicates that the row has not be inserted into
180 -- the Schema), and therefore could never have a corresponding row.
181 --
182 -- Post Failure:
183 -- A failure can only occur under two circumstances:
184 -- 1) The primary key is invalid (i.e. a row does not exist for the
185 -- specified primary key values).
186 -- 2) If an object_version_number exists but is NOT the same as the current
187 -- g_old_rec value.
188 --
189 -- Developer Implementation Notes:
190 -- None.
191 --
192 -- Access Status:
193 -- Internal Table Handler Use Only.
194 --
195 -- {End Of Comments}
196 -- ----------------------------------------------------------------------------
197 Function api_updating
198 (
199 p_address_id in number,
200 p_object_version_number in number
201 ) Return Boolean;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |---------------------------------< lck >----------------------------------|
205 -- ----------------------------------------------------------------------------
206 -- {Start Of Comments}
207 --
208 -- Description:
209 -- The Lck process has two main functions to perform. Firstly, the row to be
210 -- updated or deleted must be locked. The locking of the row will only be
211 -- successful if the row is not currently locked by another user.
212 -- Secondly, during the locking of the row, the row is selected into
213 -- the g_old_rec data structure which enables the current row values from the
214 -- server to be available to the api.
215 --
216 -- Pre Conditions:
217 -- When attempting to call the lock the object version number (if defined)
218 -- is mandatory.
219 --
220 -- In Arguments:
221 -- The arguments to the Lck process are the primary key(s) which uniquely
222 -- identify the row and the object version number of row.
223 --
224 -- Post Success:
225 -- On successful completion of the Lck process the row to be updated or
226 -- deleted will be locked and selected into the global data structure
227 -- g_old_rec.
228 --
229 -- Post Failure:
230 -- The Lck process can fail for three reasons:
231 -- 1) When attempting to lock the row the row could already be locked by
232 -- another user. This will raise the HR_Api.Object_Locked exception.
233 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
234 -- This error is trapped and reported using the message name
235 -- 'HR_7220_INVALID_PRIMARY_KEY'.
236 -- 3) The row although existing in the HR Schema has a different object
237 -- version number than the object version number specified.
238 -- This error is trapped and reported using the message name
239 -- 'HR_7155_OBJECT_INVALID'.
240 --
241 -- Developer Implementation Notes:
242 -- For each primary key and the object version number arguments add a
243 -- call to hr_api.mandatory_arg_error procedure to ensure that these
244 -- argument values are not null.
245 --
246 -- Access Status:
247 -- Internal Development Use Only.
248 --
249 -- {End Of Comments}
250 -- ----------------------------------------------------------------------------
251 Procedure lck
252 (
253 p_address_id in number,
254 p_object_version_number in number
255 );
256 --
257 -- ----------------------------------------------------------------------------
258 -- |-----------------------------< convert_args >-----------------------------|
259 -- ----------------------------------------------------------------------------
260 -- {Start Of Comments}
261 --
262 -- Description:
263 -- This function is used to turn attribute arguments into the record
264 -- structure g_rec_type.
265 --
266 -- Pre Conditions:
267 -- This is a private function and can only be called from the ins or upd
268 -- attribute processes.
269 --
270 -- In Arguments:
271 --
272 -- Post Success:
273 -- A returning record structure will be returned.
274 --
275 -- Post Failure:
276 -- No direct error handling is required within this function. Any possible
277 -- errors within this function will be a PL/SQL value error due to conversion
278 -- of datatypes or data lengths.
279 --
280 -- Developer Implementation Notes:
281 -- None.
282 --
283 -- Access Status:
284 -- Internal Table Handler Use Only.
285 --
286 -- {End Of Comments}
287 -- ----------------------------------------------------------------------------
288 Function convert_args
289 (
290 p_address_id in number,
291 p_business_group_id in number,
292 p_person_id in number,
293 p_date_from in date,
294 p_primary_flag in varchar2,
295 p_style in varchar2,
296 p_address_line1 in varchar2,
297 p_address_line2 in varchar2,
298 p_address_line3 in varchar2,
299 p_address_type in varchar2,
300 p_comments in long,
301 p_country in varchar2,
302 p_date_to in date,
303 p_postal_code in varchar2,
304 p_region_1 in varchar2,
305 p_region_2 in varchar2,
306 p_region_3 in varchar2,
307 p_telephone_number_1 in varchar2,
308 p_telephone_number_2 in varchar2,
309 p_telephone_number_3 in varchar2,
310 p_town_or_city in varchar2,
311 p_request_id in number,
312 p_program_application_id in number,
313 p_program_id in number,
314 p_program_update_date in date,
315 p_addr_attribute_category in varchar2,
316 p_addr_attribute1 in varchar2,
317 p_addr_attribute2 in varchar2,
318 p_addr_attribute3 in varchar2,
319 p_addr_attribute4 in varchar2,
320 p_addr_attribute5 in varchar2,
321 p_addr_attribute6 in varchar2,
322 p_addr_attribute7 in varchar2,
323 p_addr_attribute8 in varchar2,
324 p_addr_attribute9 in varchar2,
325 p_addr_attribute10 in varchar2,
326 p_addr_attribute11 in varchar2,
327 p_addr_attribute12 in varchar2,
328 p_addr_attribute13 in varchar2,
329 p_addr_attribute14 in varchar2,
330 p_addr_attribute15 in varchar2,
331 p_addr_attribute16 in varchar2,
332 p_addr_attribute17 in varchar2,
333 p_addr_attribute18 in varchar2,
334 p_addr_attribute19 in varchar2,
335 p_addr_attribute20 in varchar2,
336 p_object_version_number in number
337 )
338 Return g_rec_type;
339 --
340 end per_kad_shd;