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