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