1 Package Body per_za_ao_ass_ins as
2 /* $Header: pezaaain.pkb 115.1 2002/12/05 06:48:46 nsugavan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_za_ao_ass_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_ao_ass_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_za_ao_ass_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: per_za_ao_assessments
64 --
65 insert into per_za_areas_of_assessment(
66 area_of_assessment_id,
67 assessment_id,
68 area_of_assessment,
69 assessment_result,
70 assessment_criteria
71 )
72 Values
73 (
74 p_rec.area_of_assessment_id,
75 p_rec.assessment_id,
76 p_rec.area_of_assessment,
77 p_rec.assessment_result,
78 p_rec.assessment_criteria
79 );
80 --
81 per_za_ao_ass_shd.g_api_dml := false; -- Unset the api dml status
82 --
83 hr_utility.set_location(' Leaving:'||l_proc, 10);
84 Exception
85 When hr_api.check_integrity_violated Then
86 -- A check constraint has been violated
87 per_za_ao_ass_shd.g_api_dml := false; -- Unset the api dml status
88 per_za_ao_ass_shd.constraint_error
89 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
90 When hr_api.parent_integrity_violated Then
91 -- Parent integrity has been violated
92 per_za_ao_ass_shd.g_api_dml := false; -- Unset the api dml status
93 per_za_ao_ass_shd.constraint_error
94 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
95 When hr_api.unique_integrity_violated Then
96 -- Unique integrity has been violated
97 per_za_ao_ass_shd.g_api_dml := false; -- Unset the api dml status
98 per_za_ao_ass_shd.constraint_error
99 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
100 When Others Then
101 per_za_ao_ass_shd.g_api_dml := false; -- Unset the api dml status
102 Raise;
103 End insert_dml;
104
105 -- ----------------------------------------------------------------------------
106 -- |-----------------------------< post_insert >------------------------------|
107 -- ----------------------------------------------------------------------------
108 -- {Start Of Comments}
109 --
110 -- Description:
111 -- This private procedure contains any processing which is required after the
112 -- insert dml.
113 --
114 -- Pre Conditions:
115 -- This is an internal procedure which is called from the ins procedure.
116 --
117 -- In Parameters:
118 -- A Pl/Sql record structre.
119 --
120 -- Post Success:
121 -- Processing continues.
122 --
123 -- Post Failure:
124 -- If an error has occurred, an error message and exception will be raised
125 -- but not handled.
126 --
127 -- Developer Implementation Notes:
128 -- Any post-processing required after the insert dml is issued should be
129 -- coded within this procedure. It is important to note that any 3rd party
130 -- maintenance should be reviewed before placing in this procedure.
131 --
132 -- Access Status:
133 -- Internal Table Handler Use Only.
134 --
135 -- {End Of Comments}
136 -- ----------------------------------------------------------------------------
137 Procedure post_insert(p_rec in per_za_ao_ass_shd.g_za_rec_type) is
138 --
139 l_proc varchar2(72) := g_package||'post_insert';
140 --
141 Begin
142 hr_utility.set_location('Entering:'||l_proc, 5);
143 --
144 hr_utility.set_location(' Leaving:'||l_proc, 10);
145 End post_insert;
146 --
147 -- ----------------------------------------------------------------------------
148 -- |---------------------------------< ins >----------------------------------|
149 -- ----------------------------------------------------------------------------
150 Procedure ins
151 (
152 p_rec in out nocopy per_za_ao_ass_shd.g_za_rec_type,
153 p_validate in boolean default false
154 ) is
155 --
156 l_proc varchar2(72) := g_package||'ins';
157 --
158 Begin
159 hr_utility.set_location('Entering:'||l_proc, 5);
160 --
161 -- Determine if the business process is to be validated.
162 --
163 If p_validate then
164 --
165 -- Issue the savepoint.
166 --
167 SAVEPOINT ins_ass;
168 End If;
169
170 --
171 -- Insert the row
172 --
173 insert_dml(p_rec);
174 --
175 -- Call the supporting post-insert operation
176 --
177 post_insert(p_rec);
178 --
179 -- If we are validating then raise the Validate_Enabled exception
180 --
181 If p_validate then
182 Raise HR_Api.Validate_Enabled;
183 End If;
184 --
185 hr_utility.set_location(' Leaving:'||l_proc, 10);
186 Exception
187 When HR_Api.Validate_Enabled Then
188 --
189 -- As the Validate_Enabled exception has been raised
190 -- we must rollback to the savepoint
191 --
192 ROLLBACK TO ins_ass;
193 end ins;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |---------------------------------< ins >----------------------------------|
197 -- ----------------------------------------------------------------------------
198 Procedure ins
199 (
200 p_area_of_assessment_id in number,
201 p_assessment_id in number,
202 p_area_of_assessment in varchar2 default null,
203 p_assessment_result in varchar2 default null,
204 p_assessment_criteria in varchar2 default null,
205 p_validate in boolean default false
206 ) is
207 --
208 l_rec per_za_ao_ass_shd.g_za_rec_type;
209 l_proc varchar2(72) := g_package||'ins';
210 --
211 Begin
212 hr_utility.set_location('Entering:'||l_proc, 5);
213 --
214 -- Call conversion function to turn arguments into the
215 -- p_rec structure.
216 --
217 l_rec :=
218 per_za_ao_ass_shd.convert_args
219 (
220 p_area_of_assessment_id,
221 p_assessment_id,
222 p_area_of_assessment,
223 p_assessment_result,
224 p_assessment_criteria
225 );
226 --
227 -- Having converted the arguments into the ass_rec
228 -- plsql record structure we call the corresponding record business process.
229 --
230 ins(l_rec, p_validate);
231 --
232 -- As the primary key argument(s)
233 -- are specified as an OUT's we must set these values.
234 --
235 --
236 hr_utility.set_location(' Leaving:'||l_proc, 10);
237 End ins;
238 --
239 end per_za_ao_ass_ins;