DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_TCA_INS

Source


1 Package Body pqh_tca_ins as
2 /* $Header: pqtcarhi.pkb 120.2 2005/10/12 20:19:48 srajakum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqh_tca_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 pqh_tca_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   --
56   -- Insert the row into: pqh_txn_category_attributes
57   --
58   insert into pqh_txn_category_attributes
59   (	txn_category_attribute_id,
60 	attribute_id,
61 	transaction_category_id,
62 	value_set_id,
63 	object_version_number,
64 	transaction_table_route_id,
65 	form_column_name,
66 	identifier_flag,
67 	list_identifying_flag,
68 	member_identifying_flag,
69 	refresh_flag,
70         select_flag,
71 	value_style_cd
72   )
73   Values
74   (	p_rec.txn_category_attribute_id,
75 	p_rec.attribute_id,
76 	p_rec.transaction_category_id,
77 	p_rec.value_set_id,
78 	p_rec.object_version_number,
79 	p_rec.transaction_table_route_id,
80 	p_rec.form_column_name,
81 	p_rec.identifier_flag,
82 	p_rec.list_identifying_flag,
83 	p_rec.member_identifying_flag,
84 	p_rec.refresh_flag,
85         p_rec.select_flag,
86 	p_rec.value_style_cd
87   );
88   --
89   --
90   hr_utility.set_location(' Leaving:'||l_proc, 10);
91 Exception
92   When hr_api.check_integrity_violated Then
93     -- A check constraint has been violated
94     pqh_tca_shd.constraint_error
95       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
96   When hr_api.parent_integrity_violated Then
97     -- Parent integrity has been violated
98     pqh_tca_shd.constraint_error
99       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
100   When hr_api.unique_integrity_violated Then
101     -- Unique integrity has been violated
102     pqh_tca_shd.constraint_error
103       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
104   When Others Then
105     Raise;
106 End insert_dml;
107 --
108 -- ----------------------------------------------------------------------------
109 -- |------------------------------< pre_insert >------------------------------|
110 -- ----------------------------------------------------------------------------
111 -- {Start Of Comments}
112 --
113 -- Description:
114 --   This private procedure contains any processing which is required before
115 --   the insert dml. Presently, if the entity has a corresponding primary
116 --   key which is maintained by an associating sequence, the primary key for
117 --   the entity will be populated with the next sequence value in
118 --   preparation for the insert dml.
119 --
120 -- Prerequisites:
121 --   This is an internal procedure which is called from the ins procedure.
122 --
123 -- In Parameters:
124 --   A Pl/Sql record structre.
125 --
126 -- Post Success:
127 --   Processing continues.
128 --
129 -- Post Failure:
130 --   If an error has occurred, an error message and exception will be raised
131 --   but not handled.
132 --
133 -- Developer Implementation Notes:
134 --   Any pre-processing required before the insert dml is issued should be
135 --   coded within this procedure. As stated above, a good example is the
136 --   generation of a primary key number via a corresponding sequence.
137 --   It is important to note that any 3rd party maintenance should be reviewed
138 --   before placing in this procedure.
139 --
140 -- Access Status:
141 --   Internal Row Handler Use Only.
142 --
143 -- {End Of Comments}
144 -- ----------------------------------------------------------------------------
145 Procedure pre_insert(p_rec  in out nocopy pqh_tca_shd.g_rec_type) is
146 --
147   l_proc  varchar2(72) := g_package||'pre_insert';
148 --
149   Cursor C_Sel1 is select pqh_txn_category_attributes_s.nextval from sys.dual;
150 --
151 Begin
152   hr_utility.set_location('Entering:'||l_proc, 5);
153   --
154   --
155   -- Select the next sequence number
156   --
157   Open C_Sel1;
158   Fetch C_Sel1 Into p_rec.txn_category_attribute_id;
159   Close C_Sel1;
160   --
161   hr_utility.set_location(' Leaving:'||l_proc, 10);
162 End pre_insert;
163 --
164 -- ----------------------------------------------------------------------------
165 -- |-----------------------------< post_insert >------------------------------|
166 -- ----------------------------------------------------------------------------
167 -- {Start Of Comments}
168 --
169 -- Description:
170 --   This private procedure contains any processing which is required after the
171 --   insert dml.
172 --
173 -- Prerequisites:
174 --   This is an internal procedure which is called from the ins procedure.
175 --
176 -- In Parameters:
177 --   A Pl/Sql record structre.
178 --
179 -- Post Success:
180 --   Processing continues.
181 --
182 -- Post Failure:
183 --   If an error has occurred, an error message and exception will be raised
184 --   but not handled.
185 --
186 -- Developer Implementation Notes:
187 --   Any post-processing required after the insert dml is issued should be
188 --   coded within this procedure. It is important to note that any 3rd party
189 --   maintenance should be reviewed before placing in this procedure.
190 --
191 -- Access Status:
192 --   Internal Row Handler Use Only.
193 --
194 -- {End Of Comments}
195 -- ----------------------------------------------------------------------------
196 Procedure post_insert(
197 p_effective_date in date,p_rec in pqh_tca_shd.g_rec_type) is
198 --
199   l_proc  varchar2(72) := g_package||'post_insert';
200 --
201 Begin
202   hr_utility.set_location('Entering:'||l_proc, 5);
203 --
204   --
205   -- Start of API User Hook for post_insert.
206   --
207   begin
208     --
209     pqh_tca_rki.after_insert
210       (
211   p_txn_category_attribute_id     =>p_rec.txn_category_attribute_id
212  ,p_attribute_id                  =>p_rec.attribute_id
213  ,p_transaction_category_id       =>p_rec.transaction_category_id
214  ,p_value_set_id                  =>p_rec.value_set_id
215  ,p_object_version_number         =>p_rec.object_version_number
216  ,p_transaction_table_route_id    =>p_rec.transaction_table_route_id
217  ,p_form_column_name              =>p_rec.form_column_name
218  ,p_identifier_flag               =>p_rec.identifier_flag
219  ,p_list_identifying_flag         =>p_rec.list_identifying_flag
220  ,p_member_identifying_flag       =>p_rec.member_identifying_flag
221  ,p_refresh_flag                  =>p_rec.refresh_flag
222  ,p_select_flag                  =>p_rec.select_flag
223  ,p_value_style_cd                =>p_rec.value_style_cd
224  ,p_effective_date                =>p_effective_date
225       );
226     --
227   exception
228     --
229     when hr_api.cannot_find_prog_unit then
230       --
231       hr_api.cannot_find_prog_unit_error
232         (p_module_name => 'pqh_txn_category_attributes'
233         ,p_hook_type   => 'AI');
234       --
235   end;
236   --
237   -- End of API User Hook for post_insert.
238   --
239   --
240   hr_utility.set_location(' Leaving:'||l_proc, 10);
241 End post_insert;
242 --
243 -- ----------------------------------------------------------------------------
244 -- |---------------------------------< ins >----------------------------------|
245 -- ----------------------------------------------------------------------------
246 Procedure ins
247   (
248   p_effective_date in date,
249   p_rec        in out nocopy pqh_tca_shd.g_rec_type
250   ) is
251 --
252   l_proc  varchar2(72) := g_package||'ins';
253 --
254 Begin
255   hr_utility.set_location('Entering:'||l_proc, 5);
256   --
257   -- Call the supporting insert validate operations
258   --
259   pqh_tca_bus.insert_validate(p_rec
260   ,p_effective_date);
261   --
262   -- Call the supporting pre-insert operation
263   --
264   pre_insert(p_rec);
265   --
266   -- Insert the row
267   --
268   insert_dml(p_rec);
269   --
270   -- Call the supporting post-insert operation
271   --
272   post_insert(
273 p_effective_date,p_rec);
274 end ins;
275 --
276 -- ----------------------------------------------------------------------------
277 -- |---------------------------------< ins >----------------------------------|
278 -- ----------------------------------------------------------------------------
279 Procedure ins
280   (
281   p_effective_date in date,
282   p_txn_category_attribute_id    out nocopy number,
283   p_attribute_id                 in number,
284   p_transaction_category_id      in number,
285   p_value_set_id                 in number           default null,
286   p_object_version_number        out nocopy number,
287   p_transaction_table_route_id   in number           default null,
288   p_form_column_name             in varchar2         default null,
289   p_identifier_flag              in varchar2         default null,
290   p_list_identifying_flag        in varchar2         default null,
291   p_member_identifying_flag      in varchar2         default null,
292   p_refresh_flag                 in varchar2         default null,
293   p_select_flag                  in varchar2         default null,
294   p_value_style_cd               in varchar2
295   ) is
296 --
297   l_rec	  pqh_tca_shd.g_rec_type;
298   l_proc  varchar2(72) := g_package||'ins';
299 --
300 Begin
301   hr_utility.set_location('Entering:'||l_proc, 5);
302   --
303   -- Call conversion function to turn arguments into the
304   -- p_rec structure.
305   --
306   l_rec :=
307   pqh_tca_shd.convert_args
308   (
309   null,
310   p_attribute_id,
311   p_transaction_category_id,
312   p_value_set_id,
313   null,
314   p_transaction_table_route_id,
315   p_form_column_name,
316   p_identifier_flag,
317   p_list_identifying_flag,
318   p_member_identifying_flag,
319   p_refresh_flag,
320   p_select_flag,
321   p_value_style_cd
322   );
323   --
324   -- Having converted the arguments into the pqh_tca_rec
325   -- plsql record structure we call the corresponding record business process.
326   --
327   ins(
328     p_effective_date,l_rec);
329   --
330   -- As the primary key argument(s)
331   -- are specified as an OUT's we must set these values.
332   --
333   p_txn_category_attribute_id := l_rec.txn_category_attribute_id;
334   p_object_version_number := l_rec.object_version_number;
335   --
336   hr_utility.set_location(' Leaving:'||l_proc, 10);
337 End ins;
338 --
339 end pqh_tca_ins;