DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ZA_QUA_INS

Source


1 Package Body per_za_qua_ins as
2 /* $Header: pezaquin.pkb 115.1 2002/12/05 06:51:34 nsugavan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_za_qua_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 set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   3) To insert the row into the schema.
23 --   4) To trap any constraint violations that may have occurred.
24 --   5) To raise any other errors.
25 --
26 -- Pre Conditions:
27 --   This is an internal private procedure which must be called from the ins
28 --   procedure and must have all mandatory attributes set (except the
29 --   object_version_number which is initialised within this procedure).
30 --
31 -- In Parameters:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be inserted into the schema.
36 --
37 -- Post Failure:
38 --   On the insert dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a check, unique or parent integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   None.
47 --
48 -- Access Status:
49 --   Internal Table Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml(p_rec in out nocopy per_za_qua_shd.g_za_rec_type) is
54 --
55   l_proc  varchar2(72) := g_package||'insert_dml';
56 --
57 Begin
58   hr_utility.set_location('Entering:'||l_proc, 5);
59 
60   --
61   per_qua_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: per_za_formal_qualifications
64   --
65   insert into per_za_formal_qualifications
66   (	qualification_id,
67 	level_id,
68 	field_of_learning,
69 	sub_field,
70 	registration_date,
71 	registration_number
72   )
73   Values
74   (	p_rec.qualification_id,
75 	p_rec.level_id,
76 	p_rec.field_of_learning,
77 	p_rec.sub_field,
78 	p_rec.registration_date,
79 	p_rec.registration_number
80   );
81   --
82   per_qua_shd.g_api_dml := false;   -- Unset the api dml status
83   --
84   hr_utility.set_location(' Leaving:'||l_proc, 10);
85 Exception
86   When hr_api.check_integrity_violated Then
87     -- A check constraint has been violated
88     per_qua_shd.g_api_dml := false;   -- Unset the api dml status
89     per_qua_shd.constraint_error
90       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
91   When hr_api.parent_integrity_violated Then
92     -- Parent integrity has been violated
93     per_qua_shd.g_api_dml := false;   -- Unset the api dml status
94     per_qua_shd.constraint_error
95       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
96   When hr_api.unique_integrity_violated Then
97     -- Unique integrity has been violated
98     per_qua_shd.g_api_dml := false;   -- Unset the api dml status
99     per_qua_shd.constraint_error
100       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
101   When Others Then
102     per_qua_shd.g_api_dml := false;   -- Unset the api dml status
103     Raise;
104 End insert_dml;
105 
106 -- ----------------------------------------------------------------------------
107 -- |-----------------------------< post_insert >------------------------------|
108 -- ----------------------------------------------------------------------------
109 -- {Start Of Comments}
110 --
111 -- Description:
112 --   This private procedure contains any processing which is required after the
113 --   insert dml.
114 --
115 -- Pre Conditions:
116 --   This is an internal procedure which is called from the ins procedure.
117 --
118 -- In Parameters:
119 --   A Pl/Sql record structre.
120 --
121 -- Post Success:
122 --   Processing continues.
123 --
124 -- Post Failure:
125 --   If an error has occurred, an error message and exception will be raised
126 --   but not handled.
127 --
128 -- Developer Implementation Notes:
129 --   Any post-processing required after the insert dml is issued should be
130 --   coded within this procedure. It is important to note that any 3rd party
131 --   maintenance should be reviewed before placing in this procedure.
132 --
133 -- Access Status:
134 --   Internal Table Handler Use Only.
135 --
136 -- {End Of Comments}
137 -- ----------------------------------------------------------------------------
138 Procedure post_insert(p_rec in per_za_qua_shd.g_za_rec_type) is
139 --
140   l_proc  varchar2(72) := g_package||'post_insert';
141 --
142 Begin
143   hr_utility.set_location('Entering:'||l_proc, 5);
144   --
145   hr_utility.set_location(' Leaving:'||l_proc, 10);
146 End post_insert;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |---------------------------------< ins >----------------------------------|
150 -- ----------------------------------------------------------------------------
151 Procedure ins
152   (
153   p_rec            in out nocopy per_za_qua_shd.g_za_rec_type,
154   p_validate       in     boolean default false
155   ) is
156 --
157   l_proc  varchar2(72) := g_package||'ins';
158 --
159 Begin
160   hr_utility.set_location('Entering:'||l_proc, 5);
161   --
162   -- Determine if the business process is to be validated.
163   --
164   If p_validate then
165     --
166     -- Issue the savepoint.
167     --
168     SAVEPOINT ins_qua;
169   End If;
170 
171   --
172   -- Insert the row
173   --
174   insert_dml(p_rec);
175   --
176   -- Call the supporting post-insert operation
177   --
178   post_insert(p_rec);
179   --
180   -- If we are validating then raise the Validate_Enabled exception
181   --
182   If p_validate then
183     Raise HR_Api.Validate_Enabled;
184   End If;
185   --
186   hr_utility.set_location(' Leaving:'||l_proc, 10);
187 Exception
188   When HR_Api.Validate_Enabled Then
189     --
190     -- As the Validate_Enabled exception has been raised
191     -- we must rollback to the savepoint
192     --
193     ROLLBACK TO ins_qua;
194 end ins;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |---------------------------------< ins >----------------------------------|
198 -- ----------------------------------------------------------------------------
199 Procedure ins
200   (
201   p_qualification_id             in  number   default null,
202   p_level_id                     in  number	  default null,
203   p_field_of_learning            in  varchar2 default null,
204   p_sub_field                    in  varchar2 default null,
205   p_registration_date            in  date	  default null,
206   p_registration_number          in  varchar2 default null,
207   p_validate                     in  boolean  default false
208   ) is
209 --
210   l_rec	  per_za_qua_shd.g_za_rec_type;
211   l_proc  varchar2(72) := g_package||'ins';
212 --
213 Begin
214   hr_utility.set_location('Entering:'||l_proc, 5);
215   --
216   -- Call conversion function to turn arguments into the
217   -- p_rec structure.
218   --
219   l_rec :=
220   per_za_qua_shd.convert_args
221   (
222   p_qualification_id,
223   p_level_id,
224   p_field_of_learning,
225   p_sub_field,
226   p_registration_date,
227   p_registration_number
228   );
229   --
230   -- Having converted the arguments into the qua_rec
231   -- plsql record structure we call the corresponding record business process.
232   --
233   ins(l_rec, p_validate);
234   --
235   -- As the primary key argument(s)
236   -- are specified as an OUT's we must set these values.
237   --
238   --
239   hr_utility.set_location(' Leaving:'||l_proc, 10);
240 End ins;
241 --
242 end per_za_qua_ins;