1 Package pay_mgb_shd as
2 /* $Header: pymgbrhi.pkh 120.0 2005/05/29 06:45:56 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (
10 magnetic_block_id number(9),
11 block_name varchar2(80),
12 main_block_flag varchar2(30),
13 report_format varchar2(30),
14 cursor_name varchar2(80),
15 no_column_returned number(9)
16 );
17 --
18 -- ----------------------------------------------------------------------------
19 -- | Global Definitions - Internal Development Use Only |
20 -- ----------------------------------------------------------------------------
21 --
22 g_old_rec g_rec_type; -- Global record definition
23 -- Global table name
24 g_tab_nam constant varchar2(30) := 'PAY_MAGNETIC_BLOCKS';
25 --
26 g_api_dml boolean; -- Global api dml status
27 --
28 -- ----------------------------------------------------------------------------
29 -- |------------------------< return_api_dml_status >-------------------------|
30 -- ----------------------------------------------------------------------------
31 -- {Start Of Comments}
32 --
33 -- Description:
34 -- This function will return the current g_api_dml private global
35 -- boolean status.
36 -- The g_api_dml status determines if at the time of the function
37 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
38 -- is being issued from within an api.
39 -- If the status is TRUE then a dml statement is being issued from
40 -- within this entity api.
41 -- This function is primarily to support database triggers which
42 -- need to maintain the object_version_number for non-supported
43 -- dml statements (i.e. dml statement issued outside of the api layer).
44 --
45 -- Pre Conditions:
46 -- None.
47 --
48 -- In Arguments:
49 -- None.
50 --
51 -- Post Success:
52 -- Processing continues.
53 -- If the function returns a TRUE value then, dml is being executed from
54 -- within this api.
55 --
56 -- Post Failure:
57 -- None.
58 --
59 -- Access Status:
60 -- Public.
61 --
62 -- {End Of Comments}
63 -- ----------------------------------------------------------------------------
64 Function return_api_dml_status Return Boolean;
65 --
66 -- ----------------------------------------------------------------------------
67 -- |---------------------------< constraint_error >---------------------------|
68 -- ----------------------------------------------------------------------------
69 -- {Start Of Comments}
70 --
71 -- Description:
72 -- This procedure is called when a constraint has been violated (i.e.
73 -- The exception hr_api.check_integrity_violated,
74 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
75 -- hr_api.unique_integrity_violated has been raised).
76 -- The exceptions can only be raised as follows:
77 -- 1) A check constraint can only be violated during an INSERT or UPDATE
78 -- dml operation.
79 -- 2) A parent integrity constraint can only be violated during an
80 -- INSERT or UPDATE dml operation.
81 -- 3) A child integrity constraint can only be violated during an
82 -- DELETE dml operation.
83 -- 4) A unique integrity constraint can only be violated during INSERT or
84 -- UPDATE dml operation.
85 --
86 -- Pre Conditions:
87 -- 1) Either hr_api.check_integrity_violated,
88 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
89 -- hr_api.unique_integrity_violated has been raised with the subsequent
90 -- stripping of the constraint name from the generated error message
91 -- text.
92 -- 2) Standalone validation test which correspond with a constraint error.
93 --
94 -- In Arguments:
95 -- p_constraint_name is in upper format and is just the constraint name
96 -- (e.g. not prefixed by brackets, schema owner etc).
97 --
98 -- Post Success:
99 -- Development dependant.
100 --
101 -- Post Failure:
102 -- Developement dependant.
103 --
104 -- Developer Implementation Notes:
105 -- For each constraint being checked the hr system package failure message
106 -- has been generated as a template only. These system error messages should
107 -- be modified as required (i.e. change the system failure message to a user
108 -- friendly defined error message).
109 --
110 -- Access Status:
111 -- Public.
112 --
113 -- {End Of Comments}
114 -- ----------------------------------------------------------------------------
115 Procedure constraint_error
116 (p_constraint_name in all_constraints.constraint_name%TYPE);
117 --
118 -- ----------------------------------------------------------------------------
119 -- |-----------------------------< api_updating >-----------------------------|
120 -- ----------------------------------------------------------------------------
121 -- {Start Of Comments}
122 --
123 -- Description:
124 -- This function is used to populate the g_old_rec record with the
125 -- current row from the database for the specified primary key
126 -- provided that the primary key exists and is valid and does not
127 -- already match the current g_old_rec. The function will always return
128 -- a TRUE value if the g_old_rec is populated with the current row.
129 -- A FALSE value will be returned if all of the primary key arguments
130 -- are null.
131 --
132 -- Pre Conditions:
133 -- None.
134 --
135 -- In Arguments:
136 --
137 -- Post Success:
138 -- A value of TRUE will be returned indiciating that the g_old_rec
139 -- is current.
140 -- A value of FALSE will be returned if all of the primary key arguments
141 -- have a null value (this indicates that the row has not be inserted into
142 -- the Schema), and therefore could never have a corresponding row.
143 --
144 -- Post Failure:
145 -- A failure can only occur under two circumstances:
146 -- 1) The primary key is invalid (i.e. a row does not exist for the
147 -- specified primary key values).
148 -- 2) If an object_version_number exists but is NOT the same as the current
149 -- g_old_rec value.
150 --
151 -- Developer Implementation Notes:
152 -- None.
153 --
154 -- Access Status:
155 -- Internal Development Use Only.
156 --
157 -- {End Of Comments}
158 -- ----------------------------------------------------------------------------
159 Function api_updating
160 (
161 p_magnetic_block_id 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 -- Pre Conditions:
178 -- When attempting to call the lock the object version number (if defined)
179 -- is mandatory.
180 --
181 -- In Arguments:
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 -- Public.
209 --
210 -- {End Of Comments}
211 -- ----------------------------------------------------------------------------
212 Procedure lck
213 (
214 p_magnetic_block_id in number
215 );
216 --
217 -- ----------------------------------------------------------------------------
218 -- |-----------------------------< convert_args >-----------------------------|
219 -- ----------------------------------------------------------------------------
220 -- {Start Of Comments}
221 --
222 -- Description:
223 -- This function is used to turn attribute arguments into the record
224 -- structure g_rec_type.
225 --
226 -- Pre Conditions:
227 -- This is a private function and can only be called from the ins or upd
228 -- attribute processes.
229 --
230 -- In Arguments:
231 --
232 -- Post Success:
233 -- A returning record structure will be returned.
234 --
235 -- Post Failure:
236 -- No direct error handling is required within this function. Any possible
237 -- errors within this function will be a PL/SQL value error due to conversion
238 -- of datatypes or data lengths.
239 --
240 -- Developer Implementation Notes:
241 -- None.
242 --
243 -- Access Status:
244 -- Internal Development Use Only.
245 --
246 -- {End Of Comments}
247 -- ----------------------------------------------------------------------------
248 Function convert_args
249 (
250 p_magnetic_block_id in number,
251 p_block_name in varchar2,
252 p_main_block_flag in varchar2,
253 p_report_format in varchar2,
254 p_cursor_name in varchar2,
255 p_no_column_returned in number
256 )
257 Return g_rec_type;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |---------------------------< get_magnetic_block_id >----------------------|
261 -- ----------------------------------------------------------------------------
262 -- {Start Of Comments}
263 --
264 -- Description:
265 -- This function is used to return the magnetic_block_id of a
266 -- particular magnetic block from its true key - block_name and
267 -- report_format.
268 --
269 -- Prerequisites:
270 -- None
271 --
272 --
273 -- In Parameters:
274 -- block_name
275 -- report_format
276 --
277 -- Post Success:
278 -- Returns the magnetic_block_id of the corresponding magnetic block
279 -- if it exists. If the magnetic block does not exists then
280 -- the function returns null.
281 --
282 -- Post Failure:
283 -- Failure might occur if there is non unique magnetic_block_id
284 -- for the magnetic block that is being referred.
285 -- The errors are trapped and reported.
286 --
287 -- Developer Implementation Notes:
288 -- None
289 --
290 -- Access Status:
291 -- Internal Development Use Only.
292 --
293 -- {End Of Comments}
294 -- ----------------------------------------------------------------------------
295 Function get_magnetic_block_id
296 (p_block_name in varchar2
297 ,p_report_format in varchar2
298 )
299 Return number;
300 --
301 end pay_mgb_shd;