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