1 Package Body hr_qsn_del as
2 /* $Header: hrqsnrhi.pkb 120.4.12010000.3 2008/11/05 09:57:56 rsykam ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_qsn_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_qsn_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_questionnaires row.
59
60 delete from hr_questionnaires
61 where questionnaire_template_id = p_rec.questionnaire_template_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_qsn_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_qsn_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_qsn_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 hr_utility.set_location(' Leaving:'||l_proc, 10);
156 End post_delete;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |---------------------------------< del >----------------------------------|
160 -- ----------------------------------------------------------------------------
161 Procedure del
162 (p_rec in hr_qsn_shd.g_rec_type) is
163
164 l_proc varchar2(72) := g_package||'del';
165
166 Begin
167 hr_utility.set_location('Entering:'||l_proc, 5);
168
169 --We must lock the row which we need to delete.
170
171 hr_qsn_shd.lck
172 (
173 p_rec.questionnaire_template_id,
174 p_rec.object_version_number
175 );
176 --
177 -- Call the supporting delete validate operation
178 --
179 hr_qsn_bus.delete_validate(p_rec);
180 --
181 -- Call to raise any errors on multi-message list
182 hr_multi_message.end_validation_set;
183 --
184 -- Call the supporting pre-delete operation
185 --
186 pre_delete(p_rec);
187
188 --Delete the row.
189
190 delete_dml(p_rec);
191 --
192 -- Call the supporting post-delete operation
193 --
194 post_delete(p_rec);
195 -- Call to raise any errors on multi-message list
196 hr_multi_message.end_validation_set;
197 --
198 End del;
199
200 -- ----------------------------------------------------------------------------
201 -- |---------------------------------< del >----------------------------------|
202 -- ----------------------------------------------------------------------------
203 Procedure del
204 (
205 p_questionnaire_template_id in number,
206 p_object_version_number in number
207 ) is
208
209 l_rec hr_qsn_shd.g_rec_type;
210 l_proc varchar2(72) := g_package||'del';
211
212 Begin
213 hr_utility.set_location('Entering:'||l_proc, 5);
214
215 -- As the delete procedure accepts a plsql record structure we do need to
216 -- convert the arguments into the record structure.
217 -- We don't need to call the supplied conversion argument routine as we
218 -- only need a few attributes.
219
220 l_rec.questionnaire_template_id:= p_questionnaire_template_id;
221 l_rec.object_version_number := p_object_version_number;
222 --
223 -- Having converted the arguments into the hr_qsn_rec
224 -- plsql record structure we must call the corresponding entity
225 -- business process
226 --
227 del(l_rec);
228
229 hr_utility.set_location(' Leaving:'||l_proc, 10);
230 End del;
231
232 end hr_qsn_del;