4 -- ----------------------------------------------------------------------------
1 Package Body pay_ssr_ins as
2 /* $Header: pyssrrhi.pkb 120.0 2005/05/29 08:55:13 appldev noship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_ssr_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:
21 -- 3) To insert the row into the schema.
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).
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_ssr_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_sub_classi_rules
60 --
61 insert into pay_shadow_sub_classi_rules
62 ( sub_classification_rule_id,
63 element_type_id,
64 element_classification,
65 object_version_number
66 ,exclusion_rule_id
67 )
68 Values
69 ( p_rec.sub_classification_rule_id,
70 p_rec.element_type_id,
71 p_rec.element_classification,
72 p_rec.object_version_number
73 ,p_rec.exclusion_rule_id
74 );
75 --
76 --
77 hr_utility.set_location(' Leaving:'||l_proc, 10);
78 Exception
79 When hr_api.check_integrity_violated Then
80 -- A check constraint has been violated
81 pay_ssr_shd.constraint_error
82 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
83 When hr_api.parent_integrity_violated Then
84 -- Parent integrity has been violated
85 pay_ssr_shd.constraint_error
86 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
87 When hr_api.unique_integrity_violated Then
88 -- Unique integrity has been violated
89 pay_ssr_shd.constraint_error
90 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
91 When Others Then
92 Raise;
93 End insert_dml;
94 --
95 -- ----------------------------------------------------------------------------
96 -- |------------------------------< pre_insert >------------------------------|
97 -- ----------------------------------------------------------------------------
98 -- {Start Of Comments}
99 --
100 -- Description:
101 -- This private procedure contains any processing which is required before
102 -- the insert dml. Presently, if the entity has a corresponding primary
103 -- key which is maintained by an associating sequence, the primary key for
104 -- the entity will be populated with the next sequence value in
105 -- preparation for the insert dml.
106 --
107 -- Prerequisites:
108 -- This is an internal procedure which is called from the ins procedure.
109 --
110 -- In Parameters:
111 -- A Pl/Sql record structre.
112 --
113 -- Post Success:
114 -- Processing continues.
115 --
116 -- Post Failure:
117 -- If an error has occurred, an error message and exception will be raised
118 -- but not handled.
119 --
120 -- Developer Implementation Notes:
121 -- Any pre-processing required before the insert dml is issued should be
122 -- coded within this procedure. As stated above, a good example is the
123 -- generation of a primary key number via a corresponding sequence.
124 -- It is important to note that any 3rd party maintenance should be reviewed
125 -- before placing in this procedure.
126 --
127 -- Access Status:
128 -- Internal Row Handler Use Only.
129 --
130 -- {End Of Comments}
131 -- ----------------------------------------------------------------------------
132 Procedure pre_insert(p_rec in out nocopy pay_ssr_shd.g_rec_type) is
133 --
134 l_proc varchar2(72) := g_package||'pre_insert';
135 --
136 Cursor C_Sel1 is select pay_shadow_sub_classi_rules_s.nextval from sys.dual;
137 --
138 Begin
139 hr_utility.set_location('Entering:'||l_proc, 5);
140 --
141 --
142 -- Select the next sequence number
143 --
144 Open C_Sel1;
145 Fetch C_Sel1 Into p_rec.sub_classification_rule_id;
146 Close C_Sel1;
147 --
148 hr_utility.set_location(' Leaving:'||l_proc, 10);
149 End pre_insert;
150 --
151 -- ----------------------------------------------------------------------------
152 -- |-----------------------------< post_insert >------------------------------|
153 -- ----------------------------------------------------------------------------
154 -- {Start Of Comments}
155 --
156 -- Description:
157 -- This private procedure contains any processing which is required after the
158 -- insert dml.
159 --
160 -- Prerequisites:
164 -- A Pl/Sql record structre.
161 -- This is an internal procedure which is called from the ins procedure.
162 --
163 -- In Parameters:
165 --
166 -- Post Success:
167 -- Processing continues.
168 --
169 -- Post Failure:
173 -- Developer Implementation Notes:
170 -- If an error has occurred, an error message and exception will be raised
171 -- but not handled.
172 --
174 -- Any post-processing required after the insert dml is issued should be
175 -- coded within this procedure. It is important to note that any 3rd party
176 -- maintenance should be reviewed before placing in this procedure.
177 --
178 -- Access Status:
179 -- Internal Row Handler Use Only.
180 --
181 -- {End Of Comments}
182 -- ----------------------------------------------------------------------------
183 Procedure post_insert(p_rec in pay_ssr_shd.g_rec_type) is
184 --
185 l_proc varchar2(72) := g_package||'post_insert';
186 --
187 Begin
188 hr_utility.set_location('Entering:'||l_proc, 5);
189 --
190 hr_utility.set_location(' Leaving:'||l_proc, 10);
191 End post_insert;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |---------------------------------< ins >----------------------------------|
195 -- ----------------------------------------------------------------------------
196 Procedure ins
197 (
198 p_effective_date in date,
199 p_rec in out nocopy pay_ssr_shd.g_rec_type
200 ) is
201 --
202 l_proc varchar2(72) := g_package||'ins';
203 --
204 Begin
205 hr_utility.set_location('Entering:'||l_proc, 5);
206 --
207 -- Call the supporting insert validate operations
208 --
209 pay_ssr_bus.insert_validate(p_rec);
210 --
211 -- Call the supporting pre-insert operation
212 --
213 pre_insert(p_rec);
214 --
215 -- Insert the row
216 --
217 insert_dml(p_rec);
218 --
219 -- Call the supporting post-insert operation
220 --
221 post_insert(p_rec);
222 end ins;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |---------------------------------< ins >----------------------------------|
226 -- ----------------------------------------------------------------------------
227 Procedure ins
228 (
229 p_effective_date in date,
230 p_sub_classification_rule_id out nocopy number,
231 p_element_type_id in number,
232 p_element_classification in varchar2,
233 p_object_version_number out nocopy number
234 ,p_exclusion_rule_id in number default null
235 ) is
236 --
237 l_rec pay_ssr_shd.g_rec_type;
238 l_proc varchar2(72) := g_package||'ins';
239 --
240 Begin
241 hr_utility.set_location('Entering:'||l_proc, 5);
242 --
246 l_rec :=
243 -- Call conversion function to turn arguments into the
244 -- p_rec structure.
245 --
247 pay_ssr_shd.convert_args
248 (
249 null,
250 p_element_type_id,
251 p_element_classification,
252 null
253 ,p_exclusion_rule_id
254 );
255 --
256 -- Having converted the arguments into the pay_ssr_rec
257 -- plsql record structure we call the corresponding record business process.
258 --
259 ins(p_effective_date, l_rec);
260 --
261 -- As the primary key argument(s)
262 -- are specified as an OUT's we must set these values.
263 --
264 p_sub_classification_rule_id := l_rec.sub_classification_rule_id;
265 p_object_version_number := l_rec.object_version_number;
266 --
267 hr_utility.set_location(' Leaving:'||l_proc, 10);
268 End ins;
269 --
270 end pay_ssr_ins;