1 Package Body irc_vce_del as
2 /* $Header: irvcerhi.pkb 120.1 2005/12/13 06:42:58 cnholmes noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' irc_vce_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
52 (p_rec in irc_vce_shd.g_rec_type
53 ) is
54 --
55 l_proc varchar2(72) := g_package||'delete_dml';
56 --
57 Begin
58 hr_utility.set_location('Entering:'||l_proc, 5);
59 --
60 irc_vce_shd.g_api_dml := true; -- Set the api dml status
61 --
62 -- Delete the irc_variable_comp_elements row.
63 --
64 delete from irc_variable_comp_elements
65 where vacancy_id = p_rec.vacancy_id
66 and variable_comp_lookup = p_rec.variable_comp_lookup;
67 --
68 irc_vce_shd.g_api_dml := false; -- Unset the api dml status
69 --
70 hr_utility.set_location(' Leaving:'||l_proc, 10);
71 --
72 Exception
73 When hr_api.child_integrity_violated then
74 -- Child integrity has been violated
75 irc_vce_shd.g_api_dml := false; -- Unset the api dml status
76 --
77 irc_vce_shd.constraint_error
78 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
79 When Others Then
80 --
81 irc_vce_shd.g_api_dml := false; -- Unset the api dml status
82 Raise;
83 End delete_dml;
84 --
85 -- ----------------------------------------------------------------------------
86 -- |------------------------------< pre_delete >------------------------------|
87 -- ----------------------------------------------------------------------------
88 -- {Start Of Comments}
89 --
90 -- Description:
91 -- This private procedure contains any processing which is required before
92 -- the delete dml.
93 --
94 -- Prerequisites:
95 -- This is an internal procedure which is called from the del procedure.
96 --
97 -- In Parameters:
98 -- A Pl/Sql record structre.
99 --
100 -- Post Success:
101 -- Processing continues.
102 --
103 -- Post Failure:
104 -- If an error has occurred, an error message and exception will be raised
105 -- but not handled.
106 --
107 -- Developer Implementation Notes:
108 -- Any pre-processing required before the delete dml is issued should be
109 -- coded within this procedure. It is important to note that any 3rd party
110 -- maintenance should be reviewed before placing in this procedure.
111 --
112 -- Access Status:
113 -- Internal Row Handler Use Only.
114 --
115 -- {End Of Comments}
116 -- ----------------------------------------------------------------------------
117 Procedure pre_delete(p_rec in irc_vce_shd.g_rec_type) is
118 --
119 l_proc varchar2(72) := g_package||'pre_delete';
120 --
121 Begin
122 hr_utility.set_location('Entering:'||l_proc, 5);
123 --
124 hr_utility.set_location(' Leaving:'||l_proc, 10);
125 End pre_delete;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |-----------------------------< post_delete >------------------------------|
129 -- ----------------------------------------------------------------------------
130 -- {Start Of Comments}
131 --
132 -- Description:
133 -- This private procedure contains any processing which is required after
134 -- the delete dml.
135 --
136 -- Prerequistes:
137 -- This is an internal procedure which is called from the del procedure.
138 --
139 -- In Parameters:
140 -- A Pl/Sql record structure.
141 --
142 -- Post Success:
143 -- Processing continues.
144 --
145 -- Post Failure:
146 -- If an error has occurred, an error message and exception will be raised
147 -- but not handled.
148 --
149 -- Developer Implementation Notes:
150 -- Any post-processing required after the delete dml is issued should be
151 -- coded within this procedure. It is important to note that any 3rd party
152 -- maintenance should be reviewed before placing in this procedure.
153 --
154 -- Access Status:
155 -- Internal Row Handler Use Only.
156 --
157 -- {End Of Comments}
158 -- -----------------------------------------------------------------------------
159 Procedure post_delete(p_rec in irc_vce_shd.g_rec_type) is
160 --
161 l_proc varchar2(72) := g_package||'post_delete';
162 --
163 Begin
164 hr_utility.set_location('Entering:'||l_proc, 5);
165 begin
166 --
167 irc_vce_rkd.after_delete
168 (p_vacancy_id
169 => p_rec.vacancy_id
170 ,p_variable_comp_lookup
171 => p_rec.variable_comp_lookup
172 ,p_object_version_number_o
173 => irc_vce_shd.g_old_rec.object_version_number
174 );
175 --
176 exception
177 --
178 when hr_api.cannot_find_prog_unit then
179 --
180 hr_api.cannot_find_prog_unit_error
181 (p_module_name => 'IRC_VARIABLE_COMP_ELEMENTS'
182 ,p_hook_type => 'AD');
183 --
184 end;
185 --
186 hr_utility.set_location(' Leaving:'||l_proc, 10);
187 End post_delete;
188 --
189 -- ----------------------------------------------------------------------------
190 -- |---------------------------------< del >----------------------------------|
191 -- ----------------------------------------------------------------------------
192 Procedure del
193 (p_rec in irc_vce_shd.g_rec_type
194 ) is
195 --
196 l_proc varchar2(72) := g_package||'del';
197 --
198 Begin
199 hr_utility.set_location('Entering:'||l_proc, 5);
200 --
201 -- We must lock the row which we need to delete.
202 --
203 irc_vce_shd.lck
204 (p_rec.vacancy_id
205 ,p_rec.variable_comp_lookup
206 ,p_rec.object_version_number
207 );
208 --
209 -- Call the supporting delete validate operation
210 --
211 irc_vce_bus.delete_validate(p_rec);
212 -- Call to raise any errors on multi-message list
213 hr_multi_message.end_validation_set;
214 --
215 -- Call the supporting pre-delete operation
216 --
217 irc_vce_del.pre_delete(p_rec);
218 --
219 -- Delete the row.
220 --
221 irc_vce_del.delete_dml(p_rec);
222 --
223 -- Call the supporting post-delete operation
224 --
225 irc_vce_del.post_delete(p_rec);
226 -- Call to raise any errors on multi-message list
227 hr_multi_message.end_validation_set;
228 --
229 End del;
230 --
231 -- ----------------------------------------------------------------------------
232 -- |---------------------------------< del >----------------------------------|
233 -- ----------------------------------------------------------------------------
234 Procedure del
235 (p_vacancy_id in number
236 ,p_variable_comp_lookup in varchar2
237 ,p_object_version_number in number
238 ) is
239 --
240 l_rec irc_vce_shd.g_rec_type;
241 l_proc varchar2(72) := g_package||'del';
242 --
243 Begin
244 hr_utility.set_location('Entering:'||l_proc, 5);
245 --
246 -- As the delete procedure accepts a plsql record structure we do need to
247 -- convert the arguments into the record structure.
248 -- We don't need to call the supplied conversion argument routine as we
249 -- only need a few attributes.
250 --
251 l_rec.vacancy_id := p_vacancy_id;
252 l_rec.variable_comp_lookup := p_variable_comp_lookup;
253 l_rec.object_version_number := p_object_version_number;
254 --
255 -- Having converted the arguments into the irc_vce_rec
256 -- plsql record structure we must call the corresponding entity
257 -- business process
258 --
259 irc_vce_del.del(l_rec);
260 --
261 hr_utility.set_location(' Leaving:'||l_proc, 10);
262 End del;
263 --
264 end irc_vce_del;