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