1 Package Body hr_qsv_del as
2 /* $Header: hrqsvrhi.pkb 115.9 2003/08/27 00:17:34 hpandya ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_qsv_del.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< delete_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml delete logic. The functions of
17 -- this procedure are as follows:
18 -- 1) To set and unset the g_api_dml status as required (as we are about to
19 -- perform dml).
20 -- 2) To delete the specified row from the schema using the primary key in
21 -- the predicates.
22 -- 3) To trap any constraint violations that may have occurred.
23 -- 4) To raise any other errors.
24 --
25 -- Prerequisites:
26 -- This is an internal private procedure which must be called from the del
27 -- procedure.
28 --
29 -- In Parameters:
30 -- A Pl/Sql record structre.
31 --
32 -- Post Success:
33 -- The specified row will be delete from the schema.
34 --
35 -- Post Failure:
36 -- On the delete dml failure it is important to note that we always reset the
37 -- g_api_dml status to false.
38 -- If a child integrity constraint violation is raised the
39 -- constraint_error procedure will be called.
40 -- If any other error is reported, the error will be raised after the
41 -- g_api_dml status is reset.
42 --
43 -- Developer Implementation Notes:
44 -- None.
45 --
46 -- Access Status:
47 -- Internal Row Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml(p_rec in hr_qsv_shd.g_rec_type) is
52 --
53 l_proc varchar2(72) := g_package||'delete_dml';
54 --
55 Begin
56 hr_utility.set_location('Entering:'||l_proc, 5);
57 --
58 -- Delete the hr_quest_answer_values row.
59 --
60 delete from hr_quest_answer_values
61 where quest_answer_val_id = p_rec.quest_answer_val_id;
62 --
63 hr_utility.set_location(' Leaving:'||l_proc, 10);
64 --
65 Exception
66 When hr_api.child_integrity_violated then
67 -- Child integrity has been violated
68 hr_qsv_shd.constraint_error
69 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
70 When Others Then
71 Raise;
72 End delete_dml;
73 --
74 -- ----------------------------------------------------------------------------
75 -- |------------------------------< pre_delete >------------------------------|
76 -- ----------------------------------------------------------------------------
77 -- {Start Of Comments}
78 --
79 -- Description:
80 -- This private procedure contains any processing which is required before
81 -- the delete dml.
82 --
83 -- Prerequisites:
84 -- This is an internal procedure which is called from the del procedure.
85 --
86 -- In Parameters:
87 -- A Pl/Sql record structre.
88 --
89 -- Post Success:
90 -- Processing continues.
91 --
92 -- Post Failure:
93 -- If an error has occurred, an error message and exception will be raised
94 -- but not handled.
95 --
96 -- Developer Implementation Notes:
97 -- Any pre-processing required before the delete dml is issued should be
98 -- coded within this procedure. It is important to note that any 3rd party
99 -- maintenance should be reviewed before placing in this procedure.
100 --
101 -- Access Status:
102 -- Internal Row Handler Use Only.
103 --
104 -- {End Of Comments}
105 -- ----------------------------------------------------------------------------
106 Procedure pre_delete(p_rec in hr_qsv_shd.g_rec_type) is
107 --
108 l_proc varchar2(72) := g_package||'pre_delete';
109 --
110 Begin
111 hr_utility.set_location('Entering:'||l_proc, 5);
112 --
113 hr_utility.set_location(' Leaving:'||l_proc, 10);
114 End pre_delete;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |-----------------------------< post_delete >------------------------------|
118 -- ----------------------------------------------------------------------------
119 -- {Start Of Comments}
120 --
121 -- Description:
122 -- This private procedure contains any processing which is required after the
123 -- delete dml.
124 --
125 -- Prerequisites:
126 -- This is an internal procedure which is called from the del procedure.
127 --
128 -- In Parameters:
129 -- A Pl/Sql record structre.
130 --
131 -- Post Success:
132 -- Processing continues.
133 --
134 -- Post Failure:
135 -- If an error has occurred, an error message and exception will be raised
136 -- but not handled.
137 --
138 -- Developer Implementation Notes:
139 -- Any post-processing required after the delete dml is issued should be
140 -- coded within this procedure. It is important to note that any 3rd party
141 -- maintenance should be reviewed before placing in this procedure.
142 --
143 -- Access Status:
144 -- Internal table Handler Use Only.
145 --
146 -- {End Of Comments}
147 -- ----------------------------------------------------------------------------
148 Procedure post_delete(p_rec in hr_qsv_shd.g_rec_type) is
149 --
150 l_proc varchar2(72) := g_package||'post_delete';
151 --
152 Begin
153 hr_utility.set_location('Entering:'||l_proc, 5);
154 --
155 begin
156 hr_qsv_rkd.after_delete
157 (p_quest_answer_val_id => p_rec.quest_answer_val_id
158 ,p_questionnaire_answer_id_o
159 => hr_qsv_shd.g_old_rec.questionnaire_answer_id
160 ,p_field_id_o
161 => hr_qsv_shd.g_old_rec.field_id
162 ,p_object_version_number_o
163 => hr_qsv_shd.g_old_rec.object_version_number
164 ,p_value_o
165 => hr_qsv_shd.g_old_rec.value
166 );
167 exception
168 when hr_api.cannot_find_prog_unit then
169 hr_api.cannot_find_prog_unit_error
170 (p_module_name => 'HR_QUEST_ANSWER_VALUES'
171 ,p_hook_type => 'AD'
172 );
173 end;
174 --
175 hr_utility.set_location(' Leaving:'||l_proc, 10);
176 End post_delete;
177 --
178 -- ----------------------------------------------------------------------------
179 -- |---------------------------------< del >----------------------------------|
180 -- ----------------------------------------------------------------------------
181 Procedure del
182 (
183 p_rec in hr_qsv_shd.g_rec_type
184 ) is
185 --
186 l_proc varchar2(72) := g_package||'del';
187 --
188 Begin
189 hr_utility.set_location('Entering:'||l_proc, 5);
190 --
191 -- We must lock the row which we need to delete.
192 --
193 hr_qsv_shd.lck
194 (
195 p_rec.quest_answer_val_id,
196 p_rec.object_version_number
197 );
198 --
199 -- Call the supporting delete validate operation
200 --
201 hr_qsv_bus.delete_validate(p_rec);
202 --
203 -- Call the supporting pre-delete operation
204 --
205 pre_delete(p_rec);
206 --
207 -- Delete the row.
208 --
209 delete_dml(p_rec);
210 --
211 -- Call the supporting post-delete operation
212 --
213 post_delete(p_rec);
214 End del;
215 --
216 -- ----------------------------------------------------------------------------
217 -- |---------------------------------< del >----------------------------------|
218 -- ----------------------------------------------------------------------------
219 Procedure del
220 (
221 p_quest_answer_val_id in number,
222 p_object_version_number in number
223 ) is
224 --
225 l_rec hr_qsv_shd.g_rec_type;
226 l_proc varchar2(72) := g_package||'del';
227 --
228 Begin
229 hr_utility.set_location('Entering:'||l_proc, 5);
230 --
231 -- As the delete procedure accepts a plsql record structure we do need to
232 -- convert the arguments into the record structure.
233 -- We don't need to call the supplied conversion argument routine as we
234 -- only need a few attributes.
235 --
236 l_rec.quest_answer_val_id:= p_quest_answer_val_id;
237 l_rec.object_version_number := p_object_version_number;
238 --
239 -- Having converted the arguments into the hr_qsv_rec
240 -- plsql record structure we must call the corresponding entity
241 -- business process
242 --
243 del(l_rec);
244 --
245 hr_utility.set_location(' Leaving:'||l_proc, 10);
246 End del;
247 --
248 end hr_qsv_del;