1 Package Body hr_qsf_del as
2 /* $Header: hrqsfrhi.pkb 115.11 2003/08/27 00:16:45 hpandya ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_qsf_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_qsf_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_fields row.
60
61 delete from hr_quest_fields
62 where field_id = p_rec.field_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_qsf_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_qsf_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_qsf_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 hr_qsf_rkd.after_delete
157 (p_field_id
158 => p_rec.field_id
159 ,p_questionnaire_template_id_o
160 => hr_qsf_shd.g_old_rec.questionnaire_template_id
161 ,p_name_o
162 => hr_qsf_shd.g_old_rec.name
163 ,p_type_o
164 => hr_qsf_shd.g_old_rec.type
165 ,p_html_text_o
166 => hr_qsf_shd.g_old_rec.html_text
167 ,p_sql_required_flag_o
168 => hr_qsf_shd.g_old_rec.sql_required_flag
169 ,p_sql_text_o
170 => hr_qsf_shd.g_old_rec.sql_text
171 ,p_object_version_number_o
172 => hr_qsf_shd.g_old_rec.object_version_number
173 );
174 --
175 exception
176 --
177 when hr_api.cannot_find_prog_unit then
178 --
179 hr_api.cannot_find_prog_unit_error
180 (p_module_name => 'HR_QUEST_FIELDS'
181 ,p_hook_type => 'AD');
182 --
183 --
184 hr_utility.set_location(' Leaving:'||l_proc, 10);
185 End post_delete;
186 --
187 -- ----------------------------------------------------------------------------
188 -- |---------------------------------< del >----------------------------------|
189 -- ----------------------------------------------------------------------------
190 Procedure del
191 (
192 p_rec in hr_qsf_shd.g_rec_type
193 ) is
194
195 l_proc varchar2(72) := g_package||'del';
196 --
197 Begin
198 hr_utility.set_location('Entering:'||l_proc, 5);
199
200 -- We must lock the row which we need to delete.
201 --
202 hr_qsf_shd.lck
203 (
204 p_rec.field_id,
205 p_rec.object_version_number
206 );
207 --
208 -- Call the supporting delete validate operation
209 --
210 hr_qsf_bus.delete_validate(p_rec);
211 hr_multi_message.end_validation_set;
212 --
213 -- Call the supporting pre-delete operation
214 --
215 pre_delete(p_rec);
216 --
217 -- Delete the row.
218 --
219 delete_dml(p_rec);
220 --
221 -- Call the supporting post-delete operation
222 --
223 post_delete(p_rec);
224 hr_multi_message.end_validation_set;
225 End del;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |---------------------------------< del >----------------------------------|
229 -- ----------------------------------------------------------------------------
230 Procedure del
231 (
232 p_field_id in number,
233 p_object_version_number in number
234 ) is
235 --
236 l_rec hr_qsf_shd.g_rec_type;
237 l_proc varchar2(72) := g_package||'del';
238 --
239 Begin
240 hr_utility.set_location('Entering:'||l_proc, 5);
241 --
242 -- As the delete procedure accepts a plsql record structure we do need to
243 -- convert the arguments into the record structure.
244 -- We don't need to call the supplied conversion argument routine as we
245 -- only need a few attributes.
246 --
247 l_rec.field_id:= p_field_id;
248 l_rec.object_version_number := p_object_version_number;
249 --
250 -- Having converted the arguments into the hr_qsf_rec
251 -- plsql record structure we must call the corresponding entity
252 -- business process
253 --
254 del(l_rec);
255 --
256 hr_utility.set_location(' Leaving:'||l_proc, 10);
257 End del;
258 --
259 end hr_qsf_del;