[Home] [Help]
PACKAGE BODY: APPS.OTA_CCI_SHD
Source
1 Package Body ota_cci_shd as
2 /* $Header: otccirhi.pkb 120.1 2005/07/21 15:07 estreacy noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_cci_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_CERT_CAT_INCLUSIONS_UK1') 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_category_usage_id in number
40 ,p_certification_id in number
41 ,p_object_version_number in number
42 )
43 Return Boolean Is
44 --
45 --
46 -- Cursor selects the 'current' row from the HR Schema
47 --
48 Cursor C_Sel1 is
49 select
50 category_usage_id
51 ,certification_id
52 ,object_version_number
53 ,start_date_active
54 ,end_date_active
55 ,primary_flag
56 ,attribute_category
57 ,attribute1
58 ,attribute2
59 ,attribute3
60 ,attribute4
61 ,attribute5
62 ,attribute6
63 ,attribute7
64 ,attribute8
65 ,attribute9
66 ,attribute10
67 ,attribute11
68 ,attribute12
69 ,attribute13
70 ,attribute14
71 ,attribute15
72 ,attribute16
73 ,attribute17
74 ,attribute18
75 ,attribute19
76 ,attribute20
77 from ota_cert_cat_inclusions
78 where category_usage_id = p_category_usage_id
79 and certification_id = p_certification_id;
80 --
81 l_fct_ret boolean;
82 --
83 Begin
84 --
85 If (p_category_usage_id is null and
86 p_certification_id is null and
87 p_object_version_number is null
88 ) Then
89 --
90 -- One of the primary key arguments is null therefore we must
91 -- set the returning function value to false
92 --
93 l_fct_ret := false;
94 Else
95 If (p_category_usage_id
96 = ota_cci_shd.g_old_rec.category_usage_id and
97 p_certification_id
98 = ota_cci_shd.g_old_rec.certification_id and
99 p_object_version_number
100 = ota_cci_shd.g_old_rec.object_version_number
101 ) Then
102 --
103 -- The g_old_rec is current therefore we must
104 -- set the returning function to true
105 --
106 l_fct_ret := true;
107 Else
108 --
109 -- Select the current row into g_old_rec
110 --
111 Open C_Sel1;
112 Fetch C_Sel1 Into ota_cci_shd.g_old_rec;
113 If C_Sel1%notfound Then
114 Close C_Sel1;
115 --
116 -- The primary key is invalid therefore we must error
117 --
118 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
119 fnd_message.raise_error;
120 End If;
121 Close C_Sel1;
122 If (p_object_version_number
123 <> ota_cci_shd.g_old_rec.object_version_number) Then
124 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
125 fnd_message.raise_error;
126 End If;
127 l_fct_ret := true;
128 End If;
129 End If;
130 Return (l_fct_ret);
131 --
132 End api_updating;
133 --
134 -- ----------------------------------------------------------------------------
135 -- |---------------------------------< lck >----------------------------------|
136 -- ----------------------------------------------------------------------------
137 Procedure lck
138 (p_category_usage_id in number
139 ,p_certification_id in number
140 ,p_object_version_number in number
141 ) is
142 --
143 -- Cursor selects the 'current' row from the HR Schema
144 --
145 Cursor C_Sel1 is
146 select
147 category_usage_id
148 ,certification_id
149 ,object_version_number
150 ,start_date_active
151 ,end_date_active
152 ,primary_flag
153 ,attribute_category
154 ,attribute1
155 ,attribute2
156 ,attribute3
157 ,attribute4
158 ,attribute5
159 ,attribute6
160 ,attribute7
161 ,attribute8
162 ,attribute9
163 ,attribute10
164 ,attribute11
165 ,attribute12
166 ,attribute13
167 ,attribute14
168 ,attribute15
169 ,attribute16
170 ,attribute17
171 ,attribute18
172 ,attribute19
173 ,attribute20
174 from ota_cert_cat_inclusions
175 where category_usage_id = p_category_usage_id
176 and certification_id = p_certification_id
177 for update nowait;
178 --
179 l_proc varchar2(72) := g_package||'lck';
180 --
181 Begin
182 hr_utility.set_location('Entering:'||l_proc, 5);
183 --
184 hr_api.mandatory_arg_error
185 (p_api_name => l_proc
186 ,p_argument => 'CATEGORY_USAGE_ID'
187 ,p_argument_value => p_category_usage_id
188 );
189 hr_utility.set_location(l_proc,6);
190 hr_api.mandatory_arg_error
191 (p_api_name => l_proc
192 ,p_argument => 'CERTIFICATION_ID'
193 ,p_argument_value => p_certification_id
194 );
195 hr_utility.set_location(l_proc,7);
196 hr_api.mandatory_arg_error
197 (p_api_name => l_proc
198 ,p_argument => 'OBJECT_VERSION_NUMBER'
199 ,p_argument_value => p_object_version_number
200 );
201 --
202 Open C_Sel1;
203 Fetch C_Sel1 Into ota_cci_shd.g_old_rec;
204 If C_Sel1%notfound then
205 Close C_Sel1;
206 --
207 -- The primary key is invalid therefore we must error
208 --
209 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
210 fnd_message.raise_error;
211 End If;
212 Close C_Sel1;
213 If (p_object_version_number
214 <> ota_cci_shd.g_old_rec.object_version_number) Then
215 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
216 fnd_message.raise_error;
217 End If;
218 --
219 hr_utility.set_location(' Leaving:'||l_proc, 10);
220 --
221 -- We need to trap the ORA LOCK exception
222 --
223 Exception
224 When HR_Api.Object_Locked then
225 --
226 -- The object is locked therefore we need to supply a meaningful
227 -- error message.
228 --
229 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
230 fnd_message.set_token('TABLE_NAME', 'ota_cert_cat_inclusions');
231 fnd_message.raise_error;
232 End lck;
233 --
234 -- ----------------------------------------------------------------------------
235 -- |-----------------------------< convert_args >-----------------------------|
236 -- ----------------------------------------------------------------------------
237 Function convert_args
238 (p_category_usage_id in number
239 ,p_certification_id in number
240 ,p_object_version_number in number
241 ,p_start_date_active in date
242 ,p_end_date_active in date
243 ,p_primary_flag in varchar2
244 ,p_attribute_category in varchar2
245 ,p_attribute1 in varchar2
246 ,p_attribute2 in varchar2
247 ,p_attribute3 in varchar2
248 ,p_attribute4 in varchar2
249 ,p_attribute5 in varchar2
250 ,p_attribute6 in varchar2
251 ,p_attribute7 in varchar2
252 ,p_attribute8 in varchar2
253 ,p_attribute9 in varchar2
254 ,p_attribute10 in varchar2
255 ,p_attribute11 in varchar2
256 ,p_attribute12 in varchar2
257 ,p_attribute13 in varchar2
258 ,p_attribute14 in varchar2
259 ,p_attribute15 in varchar2
260 ,p_attribute16 in varchar2
261 ,p_attribute17 in varchar2
262 ,p_attribute18 in varchar2
263 ,p_attribute19 in varchar2
264 ,p_attribute20 in varchar2
265 )
266 Return g_rec_type is
267 --
268 l_rec g_rec_type;
269 --
270 Begin
271 --
272 -- Convert arguments into local l_rec structure.
273 --
274 l_rec.category_usage_id := p_category_usage_id;
275 l_rec.certification_id := p_certification_id;
276 l_rec.object_version_number := p_object_version_number;
277 l_rec.start_date_active := p_start_date_active;
278 l_rec.end_date_active := p_end_date_active;
279 l_rec.primary_flag := p_primary_flag;
280 l_rec.attribute_category := p_attribute_category;
281 l_rec.attribute1 := p_attribute1;
282 l_rec.attribute2 := p_attribute2;
283 l_rec.attribute3 := p_attribute3;
284 l_rec.attribute4 := p_attribute4;
285 l_rec.attribute5 := p_attribute5;
286 l_rec.attribute6 := p_attribute6;
287 l_rec.attribute7 := p_attribute7;
288 l_rec.attribute8 := p_attribute8;
289 l_rec.attribute9 := p_attribute9;
290 l_rec.attribute10 := p_attribute10;
291 l_rec.attribute11 := p_attribute11;
292 l_rec.attribute12 := p_attribute12;
293 l_rec.attribute13 := p_attribute13;
294 l_rec.attribute14 := p_attribute14;
295 l_rec.attribute15 := p_attribute15;
296 l_rec.attribute16 := p_attribute16;
297 l_rec.attribute17 := p_attribute17;
298 l_rec.attribute18 := p_attribute18;
299 l_rec.attribute19 := p_attribute19;
300 l_rec.attribute20 := p_attribute20;
301 --
302 -- Return the plsql record structure.
303 --
304 Return(l_rec);
305 --
306 End convert_args;
307 --
308 end ota_cci_shd;