DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SSM_SHD

Source


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