1 Package Body hr_qsa_del as
2 /* $Header: hrqsarhi.pkb 115.12 2003/08/27 00:16:05 hpandya ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_qsa_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_qsa_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 --
59 -- Delete the hr_quest_answers row.
60 --
61 delete from hr_quest_answers
62 where questionnaire_answer_id = p_rec.questionnaire_answer_id;
63 --
64 --
65 hr_utility.set_location(' Leaving:'||l_proc, 10);
66 --
67 Exception
68 When hr_api.child_integrity_violated then
69 -- Child integrity has been violated
70 hr_qsa_shd.constraint_error
71 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
72 When Others Then
73 Raise;
74 End delete_dml;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------------------------------< pre_delete >------------------------------|
78 -- ----------------------------------------------------------------------------
79 -- {Start Of Comments}
80 --
81 -- Description:
82 -- This private procedure contains any processing which is required before
83 -- the delete dml.
84 --
85 -- Prerequisites:
86 -- This is an internal procedure which is called from the del procedure.
87 --
88 -- In Parameters:
89 -- A Pl/Sql record structre.
90 --
91 -- Post Success:
92 -- Processing continues.
93 --
94 -- Post Failure:
95 -- If an error has occurred, an error message and exception will be raised
96 -- but not handled.
97 --
98 -- Developer Implementation Notes:
99 -- Any pre-processing required before the delete dml is issued should be
100 -- coded within this procedure. It is important to note that any 3rd party
101 -- maintenance should be reviewed before placing in this procedure.
102 --
103 -- Access Status:
104 -- Internal Row Handler Use Only.
105 --
106 -- {End Of Comments}
107 -- ----------------------------------------------------------------------------
108 Procedure pre_delete(p_rec in hr_qsa_shd.g_rec_type) is
109 --
110 l_proc varchar2(72) := g_package||'pre_delete';
111 --
112 Begin
113 hr_utility.set_location('Entering:'||l_proc, 5);
114 --
115 hr_utility.set_location(' Leaving:'||l_proc, 10);
116 End pre_delete;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |-----------------------------< post_delete >------------------------------|
120 -- ----------------------------------------------------------------------------
121 -- {Start Of Comments}
122 --
123 -- Description:
124 -- This private procedure contains any processing which is required after the
125 -- delete dml.
126 --
127 -- Prerequisites:
128 -- This is an internal procedure which is called from the del procedure.
129 --
130 -- In Parameters:
131 -- A Pl/Sql record structre.
132 --
133 -- Post Success:
134 -- Processing continues.
135 --
136 -- Post Failure:
137 -- If an error has occurred, an error message and exception will be raised
138 -- but not handled.
139 --
140 -- Developer Implementation Notes:
141 -- Any post-processing required after the delete dml is issued should be
142 -- coded within this procedure. It is important to note that any 3rd party
143 -- maintenance should be reviewed before placing in this procedure.
144 --
145 -- Access Status:
146 -- Internal table Handler Use Only.
147 --
148 -- {End Of Comments}
149 -- ----------------------------------------------------------------------------
150 Procedure post_delete(p_rec in hr_qsa_shd.g_rec_type) is
151 --
152 l_proc varchar2(72) := g_package||'post_delete';
153 --
154 Begin
155 hr_utility.set_location('Entering:'||l_proc, 5);
156 --
157 begin
158 hr_qsa_rkd.after_delete
159 (p_questionnaire_answer_id => p_rec.questionnaire_answer_id
160 ,p_questionnaire_template_id_o
161 => hr_qsa_shd.g_old_rec.questionnaire_template_id
162 ,p_type_o
163 => hr_qsa_shd.g_old_rec.type
164 ,p_type_object_id_o
165 => hr_qsa_shd.g_old_rec.type_object_id
166 ,p_business_group_id_o
167 => hr_qsa_shd.g_old_rec.business_group_id
168 );
169 exception
170 when hr_api.cannot_find_prog_unit then
171 hr_api.cannot_find_prog_unit_error
172 (p_module_name => 'HR_QUEST_ANSWERS'
173 ,p_hook_type => 'AD'
174 );
175 end;
176 --
177 hr_utility.set_location(' Leaving:'||l_proc, 10);
178 End post_delete;
179 --
180 -- ----------------------------------------------------------------------------
181 -- |---------------------------------< del >----------------------------------|
182 -- ----------------------------------------------------------------------------
183 Procedure del
184 (
185 p_rec in hr_qsa_shd.g_rec_type
186 ) is
187 --
188 l_proc varchar2(72) := g_package||'del';
189 --
190 Begin
191 hr_utility.set_location('Entering:'||l_proc, 5);
192 --
193 -- We must lock the row which we need to delete.
194 --
195 hr_qsa_shd.lck
196 (
197 p_rec.questionnaire_answer_id
198 );
199 --
200 -- Call the supporting delete validate operation
201 --
202 hr_qsa_bus.delete_validate(p_rec);
203 --
204 -- Call the supporting pre-delete operation
205 --
206 pre_delete(p_rec);
207 --
208 -- Delete the row.
209 --
210 delete_dml(p_rec);
211 --
212 -- Call the supporting post-delete operation
213 --
214 post_delete(p_rec);
215 End del;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |---------------------------------< del >----------------------------------|
219 -- ----------------------------------------------------------------------------
220 Procedure del
221 (
222 p_questionnaire_answer_id in number
223 ) is
224 --
225 l_rec hr_qsa_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.questionnaire_answer_id:= p_questionnaire_answer_id;
237 --
238 --
239 -- Having converted the arguments into the hr_qsa_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_qsa_del;