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