DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_CMB_SHD

Source


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