[Home] [Help]
PACKAGE BODY: APPS.OTA_CRT_SHD
Source
1 Package Body ota_crt_shd as
2 /* $Header: otcrtrhi.pkb 120.14 2006/03/17 14:54 cmora noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_crt_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 --
21 If (p_constraint_name = 'OTA_CERTIFICATIONS_B_PK') Then
22 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23 fnd_message.set_token('PROCEDURE', l_proc);
24 fnd_message.set_token('STEP','5');
25 fnd_message.raise_error;
26 Else
27 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30 fnd_message.raise_error;
31 End If;
32 --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39 (p_certification_id in number
40 ,p_object_version_number in number
41 )
42 Return Boolean Is
43 --
44 --
45 -- Cursor selects the 'current' row from the HR Schema
46 --
47 Cursor C_Sel1 is
48 select
49 certification_id
50 ,business_group_id
51 ,public_flag
52 ,initial_completion_date
53 ,initial_completion_duration
54 ,initial_compl_duration_units
55 ,renewal_duration
56 ,renewal_duration_units
57 ,notify_days_before_expire
58 ,object_version_number
59 ,start_date_active
60 ,end_date_active
61 ,attribute_category
62 ,attribute1
63 ,attribute2
64 ,attribute3
65 ,attribute4
66 ,attribute5
67 ,attribute6
68 ,attribute7
69 ,attribute8
70 ,attribute9
71 ,attribute10
72 ,attribute11
73 ,attribute12
74 ,attribute13
75 ,attribute14
76 ,attribute15
77 ,attribute16
78 ,attribute17
79 ,attribute18
80 ,attribute19
81 ,attribute20
82 ,VALIDITY_DURATION
83 ,VALIDITY_DURATION_UNITS
84 ,RENEWABLE_FLAG
85 ,VALIDITY_START_TYPE
86 ,COMPETENCY_UPDATE_LEVEL
87 from ota_certifications_b
88 where certification_id = p_certification_id;
89 --
90 l_fct_ret boolean;
91 --
92 Begin
93 --
94 If (p_certification_id is null and
95 p_object_version_number is null
96 ) Then
97 --
98 -- One of the primary key arguments is null therefore we must
99 -- set the returning function value to false
100 --
101 l_fct_ret := false;
102 Else
103 If (p_certification_id
104 = ota_crt_shd.g_old_rec.certification_id and
105 p_object_version_number
106 = ota_crt_shd.g_old_rec.object_version_number
107 ) Then
108 --
109 -- The g_old_rec is current therefore we must
110 -- set the returning function to true
111 --
112 l_fct_ret := true;
113 Else
114 --
115 -- Select the current row into g_old_rec
116 --
117 Open C_Sel1;
118 Fetch C_Sel1 Into ota_crt_shd.g_old_rec;
119 If C_Sel1%notfound Then
120 Close C_Sel1;
121 --
122 -- The primary key is invalid therefore we must error
123 --
124 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
125 fnd_message.raise_error;
126 End If;
127 Close C_Sel1;
128 If (p_object_version_number
129 <> ota_crt_shd.g_old_rec.object_version_number) Then
130 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
131 fnd_message.raise_error;
132 End If;
133 l_fct_ret := true;
134 End If;
135 End If;
136 Return (l_fct_ret);
137 --
138 End api_updating;
139 --
140 -- ----------------------------------------------------------------------------
141 -- |---------------------------------< lck >----------------------------------|
142 -- ----------------------------------------------------------------------------
143 Procedure lck
144 (p_certification_id in number
145 ,p_object_version_number in number
146 ) is
147 --
148 -- Cursor selects the 'current' row from the HR Schema
149 --
150 Cursor C_Sel1 is
151 select
152 certification_id
153 ,business_group_id
154 ,public_flag
155 ,initial_completion_date
156 ,initial_completion_duration
157 ,initial_compl_duration_units
158 ,renewal_duration
159 ,renewal_duration_units
160 ,notify_days_before_expire
161 ,object_version_number
162 ,start_date_active
163 ,end_date_active
164 ,attribute_category
165 ,attribute1
166 ,attribute2
167 ,attribute3
168 ,attribute4
169 ,attribute5
170 ,attribute6
171 ,attribute7
172 ,attribute8
173 ,attribute9
174 ,attribute10
175 ,attribute11
176 ,attribute12
177 ,attribute13
178 ,attribute14
179 ,attribute15
180 ,attribute16
181 ,attribute17
182 ,attribute18
183 ,attribute19
184 ,attribute20
185 ,VALIDITY_DURATION
186 ,VALIDITY_DURATION_UNITS
187 ,RENEWABLE_FLAG
188 ,VALIDITY_START_TYPE
189 ,COMPETENCY_UPDATE_LEVEL
190 from ota_certifications_b
191 where certification_id = p_certification_id
192 for update nowait;
193 --
194 l_proc varchar2(72) := g_package||'lck';
195 --
196 Begin
197 hr_utility.set_location('Entering:'||l_proc, 5);
198 --
199 hr_api.mandatory_arg_error
200 (p_api_name => l_proc
201 ,p_argument => 'CERTIFICATION_ID'
202 ,p_argument_value => p_certification_id
203 );
204 hr_utility.set_location(l_proc,6);
205 hr_api.mandatory_arg_error
206 (p_api_name => l_proc
207 ,p_argument => 'OBJECT_VERSION_NUMBER'
208 ,p_argument_value => p_object_version_number
209 );
210 --
211 Open C_Sel1;
212 Fetch C_Sel1 Into ota_crt_shd.g_old_rec;
213 If C_Sel1%notfound then
214 Close C_Sel1;
215 --
216 -- The primary key is invalid therefore we must error
217 --
218 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
219 fnd_message.raise_error;
220 End If;
221 Close C_Sel1;
222 If (p_object_version_number
223 <> ota_crt_shd.g_old_rec.object_version_number) Then
224 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
225 fnd_message.raise_error;
226 End If;
227 --
228 hr_utility.set_location(' Leaving:'||l_proc, 10);
229 --
230 -- We need to trap the ORA LOCK exception
231 --
232 Exception
233 When HR_Api.Object_Locked then
234 --
235 -- The object is locked therefore we need to supply a meaningful
236 -- error message.
237 --
238 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
239 fnd_message.set_token('TABLE_NAME', 'ota_certifications_b');
240 fnd_message.raise_error;
241 End lck;
242 --
243 -- ----------------------------------------------------------------------------
244 -- |-----------------------------< convert_args >-----------------------------|
245 -- ----------------------------------------------------------------------------
246 Function convert_args
247 (p_certification_id in number
248 ,p_business_group_id in number
249 ,p_public_flag in varchar2
250 ,p_initial_completion_date in date
251 ,p_initial_completion_duration in number
252 ,p_initial_compl_duration_units in varchar2
253 ,p_renewal_duration in number
254 ,p_renewal_duration_units in varchar2
255 ,p_notify_days_before_expire in number
256 ,p_object_version_number in number
257 ,p_start_date_active in date
258 ,p_end_date_active in date
259 ,p_attribute_category in varchar2
260 ,p_attribute1 in varchar2
261 ,p_attribute2 in varchar2
262 ,p_attribute3 in varchar2
263 ,p_attribute4 in varchar2
264 ,p_attribute5 in varchar2
265 ,p_attribute6 in varchar2
266 ,p_attribute7 in varchar2
267 ,p_attribute8 in varchar2
268 ,p_attribute9 in varchar2
269 ,p_attribute10 in varchar2
270 ,p_attribute11 in varchar2
271 ,p_attribute12 in varchar2
272 ,p_attribute13 in varchar2
273 ,p_attribute14 in varchar2
274 ,p_attribute15 in varchar2
275 ,p_attribute16 in varchar2
276 ,p_attribute17 in varchar2
277 ,p_attribute18 in varchar2
278 ,p_attribute19 in varchar2
279 ,p_attribute20 in varchar2
280 ,p_VALIDITY_DURATION in NUMBER
281 ,p_VALIDITY_DURATION_UNITS in VARCHAR2
282 ,p_RENEWABLE_FLAG in VARCHAR2
283 ,p_VALIDITY_START_TYPE in VARCHAR2
284 ,p_COMPETENCY_UPDATE_LEVEL in VARCHAR2
285 )
286 Return g_rec_type is
287 --
288 l_rec g_rec_type;
289 --
290 Begin
291 --
292 -- Convert arguments into local l_rec structure.
293 --
294 l_rec.certification_id := p_certification_id;
295 l_rec.business_group_id := p_business_group_id;
296 l_rec.public_flag := p_public_flag;
297 l_rec.initial_completion_date := p_initial_completion_date;
298 l_rec.initial_completion_duration := p_initial_completion_duration;
299 l_rec.initial_compl_duration_units := p_initial_compl_duration_units;
300 l_rec.renewal_duration := p_renewal_duration;
301 l_rec.renewal_duration_units := p_renewal_duration_units;
302 l_rec.notify_days_before_expire := p_notify_days_before_expire;
303 l_rec.object_version_number := p_object_version_number;
304 l_rec.start_date_active := p_start_date_active;
305 l_rec.end_date_active := p_end_date_active;
306 l_rec.attribute_category := p_attribute_category;
307 l_rec.attribute1 := p_attribute1;
308 l_rec.attribute2 := p_attribute2;
309 l_rec.attribute3 := p_attribute3;
310 l_rec.attribute4 := p_attribute4;
311 l_rec.attribute5 := p_attribute5;
312 l_rec.attribute6 := p_attribute6;
313 l_rec.attribute7 := p_attribute7;
314 l_rec.attribute8 := p_attribute8;
315 l_rec.attribute9 := p_attribute9;
316 l_rec.attribute10 := p_attribute10;
317 l_rec.attribute11 := p_attribute11;
318 l_rec.attribute12 := p_attribute12;
319 l_rec.attribute13 := p_attribute13;
320 l_rec.attribute14 := p_attribute14;
321 l_rec.attribute15 := p_attribute15;
322 l_rec.attribute16 := p_attribute16;
323 l_rec.attribute17 := p_attribute17;
324 l_rec.attribute18 := p_attribute18;
325 l_rec.attribute19 := p_attribute19;
326 l_rec.attribute20 := p_attribute20;
327 l_rec.VALIDITY_DURATION := p_VALIDITY_DURATION;
328 l_rec.VALIDITY_DURATION_UNITS := p_VALIDITY_DURATION_UNITS;
329 l_rec.RENEWABLE_FLAG := p_RENEWABLE_FLAG;
330 l_rec.VALIDITY_START_TYPE := p_VALIDITY_START_TYPE;
331 l_rec.COMPETENCY_UPDATE_LEVEL := p_COMPETENCY_UPDATE_LEVEL;
332 --
333 -- Return the plsql record structure.
334 --
335 Return(l_rec);
336 --
337 End convert_args;
338 --
339 end ota_crt_shd;