DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_TER_INS

Source


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