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