DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PSH_SHD

Source


1 Package Body per_psh_shd as
2 /* $Header: pepshrhi.pkb 120.2 2006/05/08 19:35:08 tpapired noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_psh_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 = 'PER_SCORECARD_SHARING_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_sharing_instance_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        sharing_instance_id
50       ,object_version_number
51       ,scorecard_id
52       ,person_id
53       ,attribute_category
54       ,attribute1
55       ,attribute2
56       ,attribute3
57       ,attribute4
58       ,attribute5
59       ,attribute6
60       ,attribute7
61       ,attribute8
62       ,attribute9
63       ,attribute10
64       ,attribute11
65       ,attribute12
66       ,attribute13
67       ,attribute14
68       ,attribute15
69       ,attribute16
70       ,attribute17
71       ,attribute18
72       ,attribute19
73       ,attribute20
74       ,attribute21
75       ,attribute22
76       ,attribute23
77       ,attribute24
78       ,attribute25
79       ,attribute26
80       ,attribute27
81       ,attribute28
82       ,attribute29
83       ,attribute30
84     from        per_scorecard_sharing
85     where       sharing_instance_id = p_sharing_instance_id;
86   --
87   l_fct_ret     boolean;
88   --
89 Begin
90   --
91   If (p_sharing_instance_id is null and
92       p_object_version_number is null
93      ) Then
94     --
95     -- One of the primary key arguments is null therefore we must
96     -- set the returning function value to false
97     --
98     l_fct_ret := false;
99   Else
100     If (p_sharing_instance_id
101         = per_psh_shd.g_old_rec.sharing_instance_id and
102         p_object_version_number
103         = per_psh_shd.g_old_rec.object_version_number
104        ) Then
105       --
106       -- The g_old_rec is current therefore we must
107       -- set the returning function to true
108       --
109       l_fct_ret := true;
110     Else
111       --
112       -- Select the current row into g_old_rec
113       --
114       Open C_Sel1;
115       Fetch C_Sel1 Into per_psh_shd.g_old_rec;
116       If C_Sel1%notfound Then
117         Close C_Sel1;
118         --
119         -- The primary key is invalid therefore we must error
120         --
121         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
122         fnd_message.raise_error;
123       End If;
124       Close C_Sel1;
125       If (p_object_version_number
126           <> per_psh_shd.g_old_rec.object_version_number) Then
127         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
128         fnd_message.raise_error;
129       End If;
130       l_fct_ret := true;
131     End If;
132   End If;
133   Return (l_fct_ret);
134 --
135 End api_updating;
136 --
137 -- ----------------------------------------------------------------------------
138 -- |---------------------------------< lck >----------------------------------|
139 -- ----------------------------------------------------------------------------
140 Procedure lck
141   (p_sharing_instance_id                  in     number
142   ,p_object_version_number                in     number
143   ) is
144 --
145 -- Cursor selects the 'current' row from the HR Schema
146 --
147   Cursor C_Sel1 is
148     select
149        sharing_instance_id
150       ,object_version_number
151       ,scorecard_id
152       ,person_id
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       ,attribute21
175       ,attribute22
176       ,attribute23
177       ,attribute24
178       ,attribute25
179       ,attribute26
180       ,attribute27
181       ,attribute28
182       ,attribute29
183       ,attribute30
184     from        per_scorecard_sharing
185     where       sharing_instance_id = p_sharing_instance_id
186     for update nowait;
187 --
188   l_proc        varchar2(72) := g_package||'lck';
189 --
190 Begin
191   hr_utility.set_location('Entering:'||l_proc, 5);
192   --
193   hr_api.mandatory_arg_error
194     (p_api_name           => l_proc
195     ,p_argument           => 'SHARING_INSTANCE_ID'
196     ,p_argument_value     => p_sharing_instance_id
197     );
198   hr_utility.set_location(l_proc,6);
199   hr_api.mandatory_arg_error
200     (p_api_name           => l_proc
201     ,p_argument           => 'OBJECT_VERSION_NUMBER'
202     ,p_argument_value     => p_object_version_number
203     );
204   --
205   Open  C_Sel1;
206   Fetch C_Sel1 Into per_psh_shd.g_old_rec;
207   If C_Sel1%notfound then
208     Close C_Sel1;
209     --
210     -- The primary key is invalid therefore we must error
211     --
212     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
213     fnd_message.raise_error;
214   End If;
215   Close C_Sel1;
216   If (p_object_version_number
217       <> per_psh_shd.g_old_rec.object_version_number) Then
218         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
219         fnd_message.raise_error;
220   End If;
221   --
222   hr_utility.set_location(' Leaving:'||l_proc, 10);
223   --
224   -- We need to trap the ORA LOCK exception
225   --
226 Exception
227   When HR_Api.Object_Locked then
228     --
229     -- The object is locked therefore we need to supply a meaningful
230     -- error message.
231     --
232     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
233     fnd_message.set_token('TABLE_NAME', 'per_scorecard_sharing');
234     fnd_message.raise_error;
235 End lck;
236 --
237 -- ----------------------------------------------------------------------------
238 -- |-----------------------------< convert_args >-----------------------------|
239 -- ----------------------------------------------------------------------------
240 Function convert_args
241   (p_sharing_instance_id            in number
242   ,p_object_version_number          in number
243   ,p_scorecard_id                   in number
244   ,p_person_id                      in number
245   ,p_attribute_category             in varchar2
246   ,p_attribute1                     in varchar2
247   ,p_attribute2                     in varchar2
248   ,p_attribute3                     in varchar2
249   ,p_attribute4                     in varchar2
250   ,p_attribute5                     in varchar2
251   ,p_attribute6                     in varchar2
252   ,p_attribute7                     in varchar2
253   ,p_attribute8                     in varchar2
254   ,p_attribute9                     in varchar2
255   ,p_attribute10                    in varchar2
256   ,p_attribute11                    in varchar2
257   ,p_attribute12                    in varchar2
258   ,p_attribute13                    in varchar2
259   ,p_attribute14                    in varchar2
260   ,p_attribute15                    in varchar2
261   ,p_attribute16                    in varchar2
262   ,p_attribute17                    in varchar2
263   ,p_attribute18                    in varchar2
264   ,p_attribute19                    in varchar2
265   ,p_attribute20                    in varchar2
266   ,p_attribute21                    in varchar2
267   ,p_attribute22                    in varchar2
268   ,p_attribute23                    in varchar2
269   ,p_attribute24                    in varchar2
270   ,p_attribute25                    in varchar2
271   ,p_attribute26                    in varchar2
272   ,p_attribute27                    in varchar2
273   ,p_attribute28                    in varchar2
274   ,p_attribute29                    in varchar2
275   ,p_attribute30                    in varchar2
276   )
277   Return g_rec_type is
278 --
279   l_rec   g_rec_type;
280 --
281 Begin
282   --
283   -- Convert arguments into local l_rec structure.
284   --
285   l_rec.sharing_instance_id              := p_sharing_instance_id;
286   l_rec.object_version_number            := p_object_version_number;
287   l_rec.scorecard_id                     := p_scorecard_id;
288   l_rec.person_id                        := p_person_id;
289   l_rec.attribute_category               := p_attribute_category;
290   l_rec.attribute1                       := p_attribute1;
291   l_rec.attribute2                       := p_attribute2;
292   l_rec.attribute3                       := p_attribute3;
293   l_rec.attribute4                       := p_attribute4;
294   l_rec.attribute5                       := p_attribute5;
295   l_rec.attribute6                       := p_attribute6;
296   l_rec.attribute7                       := p_attribute7;
297   l_rec.attribute8                       := p_attribute8;
298   l_rec.attribute9                       := p_attribute9;
299   l_rec.attribute10                      := p_attribute10;
300   l_rec.attribute11                      := p_attribute11;
301   l_rec.attribute12                      := p_attribute12;
302   l_rec.attribute13                      := p_attribute13;
303   l_rec.attribute14                      := p_attribute14;
304   l_rec.attribute15                      := p_attribute15;
305   l_rec.attribute16                      := p_attribute16;
306   l_rec.attribute17                      := p_attribute17;
307   l_rec.attribute18                      := p_attribute18;
308   l_rec.attribute19                      := p_attribute19;
309   l_rec.attribute20                      := p_attribute20;
310   l_rec.attribute21                      := p_attribute21;
311   l_rec.attribute22                      := p_attribute22;
312   l_rec.attribute23                      := p_attribute23;
313   l_rec.attribute24                      := p_attribute24;
314   l_rec.attribute25                      := p_attribute25;
315   l_rec.attribute26                      := p_attribute26;
316   l_rec.attribute27                      := p_attribute27;
317   l_rec.attribute28                      := p_attribute28;
318   l_rec.attribute29                      := p_attribute29;
319   l_rec.attribute30                      := p_attribute30;
320   --
321   -- Return the plsql record structure.
322   --
323   Return(l_rec);
324 --
325 End convert_args;
326 --
327 end per_psh_shd;