DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ASR_SHD

Source


1 Package Body per_asr_shd as
2 /* $Header: peasrrhi.pkb 115.5 99/10/05 09:44:16 porting ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_asr_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16   l_proc 	varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19   hr_utility.set_location('Entering:'||l_proc, 5);
20   --
21   If (p_constraint_name = 'PER_ASSESSMENT_GROUPS_PK') Then
22     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
23     hr_utility.set_message_token('PROCEDURE', l_proc);
24     hr_utility.set_message_token('STEP','5');
25     hr_utility.raise_error;
26   ElsIf (p_constraint_name = 'PER_ASSESSMENT_GROUPS_NAME_UK1') Then
27     hr_utility.set_message(801, 'HR_51594_ASR_NAME_NOT_UNIQ');
28      hr_utility.raise_error;
29   Else
30     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
31     hr_utility.set_message_token('PROCEDURE', l_proc);
32     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
33     hr_utility.raise_error;
34   End If;
35   --
36   hr_utility.set_location(' Leaving:'||l_proc, 10);
37 End constraint_error;
38 --
39 -- ----------------------------------------------------------------------------
40 -- |-----------------------------< api_updating >-----------------------------|
41 -- ----------------------------------------------------------------------------
42 Function api_updating
43   (
44   p_assessment_group_id                in number,
45   p_object_version_number              in number
46   )      Return Boolean Is
47 --
48   --
49   -- Cursor selects the 'current' row from the HR Schema
50   --
51   Cursor C_Sel1 is
52     select
53         assessment_group_id,
54 	name,
55 	business_group_id,
56 	membership_list,
57 	comments,
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 	object_version_number
80     from	per_assessment_groups
81     where	assessment_group_id = p_assessment_group_id;
82 --
83   l_proc	varchar2(72)	:= g_package||'api_updating';
84   l_fct_ret	boolean;
85 --
86 Begin
87   hr_utility.set_location('Entering:'||l_proc, 5);
88   --
89   If (
90 	p_assessment_group_id is null and
91 	p_object_version_number is null
92      ) Then
93     --
94     -- One of the primary key arguments is null therefore we must
95     -- set the returning function value to false
96     --
97     l_fct_ret := false;
98   Else
99     If (
100 	p_assessment_group_id = g_old_rec.assessment_group_id and
101 	p_object_version_number = g_old_rec.object_version_number
102        ) Then
103       hr_utility.set_location(l_proc, 10);
104       --
105       -- The g_old_rec is current therefore we must
106       -- set the returning function to true
107       --
108       l_fct_ret := true;
109     Else
110       --
111       -- Select the current row into g_old_rec
112       --
113       Open C_Sel1;
114       Fetch C_Sel1 Into g_old_rec;
115       If C_Sel1%notfound Then
116         Close C_Sel1;
117         --
118         -- The primary key is invalid therefore we must error
119         --
120         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
121         hr_utility.raise_error;
122       End If;
123       Close C_Sel1;
124       If (p_object_version_number <> g_old_rec.object_version_number) Then
125         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
126         hr_utility.raise_error;
127       End If;
128       hr_utility.set_location(l_proc, 15);
129       l_fct_ret := true;
130     End If;
131   End If;
132   hr_utility.set_location(' Leaving:'||l_proc, 20);
133   Return (l_fct_ret);
134 --
135 End api_updating;
136 --
137 -- ----------------------------------------------------------------------------
138 -- |---------------------------------< lck >----------------------------------|
139 -- ----------------------------------------------------------------------------
140 Procedure lck
141   (
142   p_assessment_group_id                in number,
143   p_object_version_number              in number
144   ) is
145 --
146 -- Cursor selects the 'current' row from the HR Schema
147 --
148   Cursor C_Sel1 is
149     select 	assessment_group_id,
150 	name,
151 	business_group_id,
152 	membership_list,
153 	comments,
154 	attribute_category,
155 	attribute1,
156 	attribute2,
157 	attribute3,
158 	attribute4,
159 	attribute5,
160 	attribute6,
161 	attribute7,
162 	attribute8,
163 	attribute9,
164 	attribute10,
165 	attribute11,
166 	attribute12,
167 	attribute13,
168 	attribute14,
169 	attribute15,
170 	attribute16,
171 	attribute17,
172 	attribute18,
173 	attribute19,
174 	attribute20,
175 	object_version_number
176     from	per_assessment_groups
177     where	assessment_group_id = p_assessment_group_id
178     for	update nowait;
179 --
180   l_proc	varchar2(72) := g_package||'lck';
181 --
182 Begin
183   hr_utility.set_location('Entering:'||l_proc, 5);
184   --
185   -- Add any mandatory argument checking here:
186   -- Example:
187   -- hr_api.mandatory_arg_error
188   --   (p_api_name       => l_proc,
189   --    p_argument       => 'object_version_number',
190   --    p_argument_value => p_object_version_number);
191   --
192   Open  C_Sel1;
193   Fetch C_Sel1 Into g_old_rec;
194   If C_Sel1%notfound then
195     Close C_Sel1;
196     --
197     -- The primary key is invalid therefore we must error
198     --
199     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
200     hr_utility.raise_error;
201   End If;
202   Close C_Sel1;
203   If (p_object_version_number <> g_old_rec.object_version_number) Then
204         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
205         hr_utility.raise_error;
206       End If;
207 --
208   hr_utility.set_location(' Leaving:'||l_proc, 10);
209 --
210 -- We need to trap the ORA LOCK exception
211 --
212 Exception
213   When HR_Api.Object_Locked then
214     --
215     -- The object is locked therefore we need to supply a meaningful
216     -- error message.
217     --
218     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
219     hr_utility.set_message_token('TABLE_NAME', 'per_assessment_groups');
220     hr_utility.raise_error;
221 End lck;
222 --
223 -- ----------------------------------------------------------------------------
224 -- |-----------------------------< convert_args >-----------------------------|
225 -- ----------------------------------------------------------------------------
226 Function convert_args
227 	(
228 	p_assessment_group_id           in number,
229 	p_name                          in varchar2,
230 	p_business_group_id             in number,
231 	p_membership_list               in varchar2,
232 	p_comments                      in varchar2,
233 	p_attribute_category            in varchar2,
234 	p_attribute1                    in varchar2,
235 	p_attribute2                    in varchar2,
236 	p_attribute3                    in varchar2,
237 	p_attribute4                    in varchar2,
238 	p_attribute5                    in varchar2,
239 	p_attribute6                    in varchar2,
240 	p_attribute7                    in varchar2,
241 	p_attribute8                    in varchar2,
242 	p_attribute9                    in varchar2,
243 	p_attribute10                   in varchar2,
244 	p_attribute11                   in varchar2,
245 	p_attribute12                   in varchar2,
246 	p_attribute13                   in varchar2,
247 	p_attribute14                   in varchar2,
248 	p_attribute15                   in varchar2,
249 	p_attribute16                   in varchar2,
250 	p_attribute17                   in varchar2,
251 	p_attribute18                   in varchar2,
252 	p_attribute19                   in varchar2,
253 	p_attribute20                   in varchar2,
254 	p_object_version_number         in number
255 	)
256 	Return g_rec_type is
257 --
258   l_rec	  g_rec_type;
259   l_proc  varchar2(72) := g_package||'convert_args';
260 --
261 Begin
262   --
263   hr_utility.set_location('Entering:'||l_proc, 5);
264   --
265   -- Convert arguments into local l_rec structure.
266   --
267   l_rec.assessment_group_id              := p_assessment_group_id;
268   l_rec.name                             := p_name;
269   l_rec.business_group_id                := p_business_group_id;
270   l_rec.membership_list                  := p_membership_list;
271   l_rec.comments                         := p_comments;
272   l_rec.attribute_category               := p_attribute_category;
273   l_rec.attribute1                       := p_attribute1;
274   l_rec.attribute2                       := p_attribute2;
275   l_rec.attribute3                       := p_attribute3;
276   l_rec.attribute4                       := p_attribute4;
277   l_rec.attribute5                       := p_attribute5;
278   l_rec.attribute6                       := p_attribute6;
279   l_rec.attribute7                       := p_attribute7;
280   l_rec.attribute8                       := p_attribute8;
281   l_rec.attribute9                       := p_attribute9;
282   l_rec.attribute10                      := p_attribute10;
283   l_rec.attribute11                      := p_attribute11;
284   l_rec.attribute12                      := p_attribute12;
285   l_rec.attribute13                      := p_attribute13;
286   l_rec.attribute14                      := p_attribute14;
287   l_rec.attribute15                      := p_attribute15;
288   l_rec.attribute16                      := p_attribute16;
289   l_rec.attribute17                      := p_attribute17;
290   l_rec.attribute18                      := p_attribute18;
291   l_rec.attribute19                      := p_attribute19;
292   l_rec.attribute20                      := p_attribute20;
293   l_rec.object_version_number            := p_object_version_number;
294   --
295   -- Return the plsql record structure.
296   --
297   hr_utility.set_location(' Leaving:'||l_proc, 10);
298   Return(l_rec);
299 --
300 End convert_args;
301 --
302 end per_asr_shd;