1 Package Body pay_ppe_ins as
2 /* $Header: pypperhi.pkb 115.2 2000/10/10 04:48:04 pkm ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_ppe_ins.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< insert_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml insert logic. The processing of
17 -- this procedure are as follows:
18 -- 1) Initialise the object_version_number to 1 if the object_version_number
19 -- is defined as an attribute for this entity.
20 -- 2) To set and unset the g_api_dml status as required (as we are about to
21 -- perform dml).
22 -- 3) To insert the row into the schema.
23 -- 4) To trap any constraint violations that may have occurred.
24 -- 5) To raise any other errors.
25 --
26 -- Prerequisites:
27 -- This is an internal private procedure which must be called from the ins
28 -- procedure and must have all mandatory attributes set (except the
29 -- object_version_number which is initialised within this procedure).
30 --
31 -- In Parameters:
32 -- A Pl/Sql record structre.
33 --
34 -- Post Success:
35 -- The specified row will be inserted into the schema.
36 --
37 -- Post Failure:
38 -- On the insert dml failure it is important to note that we always reset the
39 -- g_api_dml status to false.
40 -- If a check, unique or parent integrity constraint violation is raised the
41 -- constraint_error procedure will be called.
42 -- If any other error is reported, the error will be raised after the
43 -- g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 -- None.
47 --
48 -- Access Status:
49 -- Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml
54 (p_rec in out pay_ppe_shd.g_rec_type
55 ) is
56 --
57 l_proc varchar2(72) := g_package||'insert_dml';
58 --
59 Begin
60 hr_utility.set_location('Entering:'||l_proc, 5);
61 --
62 -- In this particular table we don't think the object version number will
63 -- need to be altered.
64 --
65 p_rec.object_version_number := 1; -- Initialise the object version
66 --
67 --
68 --
69 -- Insert the row into: pay_process_events
70 --
71 insert into pay_process_events
72 (process_event_id
73 ,assignment_id
74 ,effective_date
75 ,change_type
76 ,status
77 ,description
78 ,object_version_number
79 )
80 Values
81 (p_rec.process_event_id
82 ,p_rec.assignment_id
83 ,p_rec.effective_date
84 ,p_rec.change_type
85 ,p_rec.status
86 ,p_rec.description
87 ,p_rec.object_version_number
88 );
89 --
90 --
91 --
92 hr_utility.set_location(' Leaving:'||l_proc, 10);
93 Exception
94 When hr_api.check_integrity_violated Then
95 -- A check constraint has been violated
96 --
97 pay_ppe_shd.constraint_error
98 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
99 When hr_api.parent_integrity_violated Then
100 -- Parent integrity has been violated
101 --
102 pay_ppe_shd.constraint_error
103 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
104 When hr_api.unique_integrity_violated Then
105 -- Unique integrity has been violated
106 --
107 pay_ppe_shd.constraint_error
108 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
109 When Others Then
110 --
111 Raise;
112 End insert_dml;
113 --
114 -- ----------------------------------------------------------------------------
115 -- |------------------------------< pre_insert >------------------------------|
116 -- ----------------------------------------------------------------------------
117 -- {Start Of Comments}
118 --
119 -- Description:
120 -- This private procedure contains any processing which is required before
121 -- the insert dml. Presently, if the entity has a corresponding primary
122 -- key which is maintained by an associating sequence, the primary key for
123 -- the entity will be populated with the next sequence value in
124 -- preparation for the insert dml.
125 --
126 -- Prerequisites:
127 -- This is an internal procedure which is called from the ins procedure.
128 --
129 -- In Parameters:
130 -- A Pl/Sql record structre.
131 --
132 -- Post Success:
133 -- Processing continues.
134 --
135 -- Post Failure:
136 -- If an error has occurred, an error message and exception will be raised
137 -- but not handled.
138 --
139 -- Developer Implementation Notes:
140 -- Any pre-processing required before the insert dml is issued should be
141 -- coded within this procedure. As stated above, a good example is the
142 -- generation of a primary key number via a corresponding sequence.
143 -- It is important to note that any 3rd party maintenance should be reviewed
144 -- before placing in this procedure.
145 --
146 -- Access Status:
147 -- Internal Row Handler Use Only.
148 --
149 -- {End Of Comments}
150 -- ----------------------------------------------------------------------------
151 Procedure pre_insert
152 (p_rec in out pay_ppe_shd.g_rec_type
153 ) is
154 --
155 l_proc varchar2(72) := g_package||'pre_insert';
156 --
157 Cursor C_Sel1 is select pay_process_events_s.nextval from sys.dual;
158 --
159 Begin
160 hr_utility.set_location('Entering:'||l_proc, 5);
161 --
162 --
163 -- Select the next sequence number
164 --
165 Open C_Sel1;
166 Fetch C_Sel1 Into p_rec.process_event_id;
167 Close C_Sel1;
168 --
169 hr_utility.set_location(' Leaving:'||l_proc, 10);
170 End pre_insert;
171 --
172 -- ----------------------------------------------------------------------------
173 -- |-----------------------------< post_insert >------------------------------|
174 -- ----------------------------------------------------------------------------
175 -- {Start Of Comments}
176 --
177 -- Description:
178 -- This private procedure contains any processing which is required after the
179 -- insert dml.
180 --
181 -- Prerequisites:
182 -- This is an internal procedure which is called from the ins procedure.
183 --
184 -- In Parameters:
185 -- A Pl/Sql record structre.
186 --
187 -- Post Success:
188 -- Processing continues.
189 --
190 -- Post Failure:
191 -- If an error has occurred, an error message and exception will be raised
192 -- but not handled.
193 --
194 -- Developer Implementation Notes:
195 -- Any post-processing required after the insert dml is issued should be
196 -- coded within this procedure. It is important to note that any 3rd party
197 -- maintenance should be reviewed before placing in this procedure.
198 --
199 -- Access Status:
200 -- Internal Row Handler Use Only.
201 --
202 -- {End Of Comments}
203 -- ----------------------------------------------------------------------------
204 Procedure post_insert
205 (p_rec in pay_ppe_shd.g_rec_type
206 ) is
207 --
208 l_proc varchar2(72) := g_package||'post_insert';
209 --
210 Begin
211 hr_utility.set_location('Entering:'||l_proc, 5);
212 hr_utility.set_location(' Leaving:'||l_proc, 10);
213 End post_insert;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |---------------------------------< ins >----------------------------------|
217 -- ----------------------------------------------------------------------------
218 Procedure ins
219 (p_rec in out pay_ppe_shd.g_rec_type
220 ) is
221 --
222 l_proc varchar2(72) := g_package||'ins';
223 --
224 Begin
225 hr_utility.set_location('Entering:'||l_proc, 5);
226 --
227 -- Call the supporting insert validate operations
228 --
229 pay_ppe_bus.insert_validate
230 (p_rec
231 );
232 --
233 -- Call the supporting pre-insert operation
234 --
235 pay_ppe_ins.pre_insert(p_rec);
236 --
237 -- Insert the row
238 --
239 pay_ppe_ins.insert_dml(p_rec);
240 --
241 -- Call the supporting post-insert operation
242 --
243 pay_ppe_ins.post_insert
244 (p_rec
245 );
246 --
247 hr_utility.set_location('Leaving:'||l_proc, 20);
248 end ins;
249 --
250 -- ----------------------------------------------------------------------------
251 -- |---------------------------------< ins >----------------------------------|
252 -- ----------------------------------------------------------------------------
253 Procedure ins
254 (p_assignment_id in number
255 ,p_effective_date in date
256 ,p_change_type in varchar2
257 ,p_status in varchar2
258 ,p_description in varchar2 default null
259 ,p_process_event_id out number
260 ,p_object_version_number out number
261 ) is
262 --
263 l_rec pay_ppe_shd.g_rec_type;
264 l_proc varchar2(72) := g_package||'ins';
265 --
266 Begin
267 hr_utility.set_location('Entering:'||l_proc, 5);
268 --
269 -- Call conversion function to turn arguments into the
270 -- p_rec structure.
271 --
272 l_rec :=
273 pay_ppe_shd.convert_args
274 (null
275 ,p_assignment_id
276 ,p_effective_date
277 ,p_change_type
278 ,p_status
279 ,p_description
280 ,null
281 );
282 --
283 -- Having converted the arguments into the pay_ppe_rec
284 -- plsql record structure we call the corresponding record business process.
285 --
286 pay_ppe_ins.ins
287 (l_rec
288 );
289 --
290 -- As the primary key argument(s)
291 -- are specified as an OUT's we must set these values.
292 --
293 p_process_event_id := l_rec.process_event_id;
294 p_object_version_number := l_rec.object_version_number;
295 --
296 hr_utility.set_location(' Leaving:'||l_proc, 10);
297 End ins;
298 --
299 end pay_ppe_ins;