DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_CEC_INS

Source


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