[Home] [Help]
PACKAGE BODY: APPS.PER_PSS_SHD
Source
1 Package Body per_pss_shd as
2 /* $Header: pepssrhi.pkb 120.1 2006/08/08 11:27:06 amigarg noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_pss_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_SALARY_SURVEYS_PK') Then
22 hr_utility.set_message(800, 'THE 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_SALARY_SURVEYS_UK1') Then
27 hr_utility.set_message(800, 'PER_50330_INV_SURVEY_COMB');
28 hr_utility.raise_error;
29 Else
30 hr_utility.set_message(800, '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_salary_survey_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 salary_survey_id,
54 object_version_number,
55 survey_name,
56 survey_company_code,
57 identifier,
58 --ras currency_code,
59 survey_type_code,
60 base_region,
61 attribute_category,
62 attribute1,
63 attribute2,
64 attribute3,
65 attribute4,
66 attribute5,
67 attribute6,
68 attribute7,
69 attribute8,
70 attribute9,
71 attribute10,
72 attribute11,
73 attribute12,
74 attribute13,
75 attribute14,
76 attribute15,
77 attribute16,
78 attribute17,
79 attribute18,
80 attribute19,
81 attribute20
82 from per_salary_surveys
83 where salary_survey_id = p_salary_survey_id;
84 --
85 l_proc varchar2(72) := g_package||'api_updating';
86 l_fct_ret boolean;
87 --
88 Begin
89 hr_utility.set_location('Entering:'||l_proc, 5);
90 --
91 If (
92 p_salary_survey_id is null and
93 p_object_version_number is null
94 ) Then
95 --
96 -- One of the primary key arguments is null therefore we must
97 -- set the returning function value to false
98 --
99 l_fct_ret := false;
100 Else
101 If (
102 p_salary_survey_id = g_old_rec.salary_survey_id and
103 p_object_version_number = g_old_rec.object_version_number
104 ) Then
105 hr_utility.set_location(l_proc, 10);
106 --
107 -- The g_old_rec is current therefore we must
108 -- set the returning function to true
109 --
110 l_fct_ret := true;
111 Else
112 --
113 -- Select the current row into g_old_rec
114 --
115 Open C_Sel1;
116 Fetch C_Sel1 Into g_old_rec;
117 If C_Sel1%notfound Then
118 Close C_Sel1;
119 --
120 -- The primary key is invalid therefore we must error
121 --
122 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
123 hr_utility.raise_error;
124 End If;
125 Close C_Sel1;
126 If (p_object_version_number <> g_old_rec.object_version_number) Then
127 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
128 hr_utility.raise_error;
129 End If;
130 hr_utility.set_location(l_proc, 15);
131 l_fct_ret := true;
132 End If;
133 End If;
134 hr_utility.set_location(' Leaving:'||l_proc, 20);
135 Return (l_fct_ret);
136 --
137 End api_updating;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |---------------------------------< lck >----------------------------------|
141 -- ----------------------------------------------------------------------------
142 Procedure lck
143 (
144 p_salary_survey_id in number,
145 p_object_version_number in number
146 ) is
147 --
148 -- Cursor selects the 'current' row from the HR Schema
149 --
150 Cursor C_Sel1 is
151 select salary_survey_id,
152 object_version_number,
153 survey_name,
154 survey_company_code,
155 identifier,
156 --ras-- currency_code,
157 survey_type_code,
158 base_region,
159 attribute_category,
160 attribute1,
161 attribute2,
162 attribute3,
163 attribute4,
164 attribute5,
165 attribute6,
166 attribute7,
167 attribute8,
168 attribute9,
169 attribute10,
170 attribute11,
171 attribute12,
172 attribute13,
173 attribute14,
174 attribute15,
175 attribute16,
176 attribute17,
177 attribute18,
178 attribute19,
179 attribute20
180 from per_salary_surveys
181 where salary_survey_id = p_salary_survey_id
182 for update nowait;
183 --
184 l_proc varchar2(72) := g_package||'lck';
185 --
186 Begin
187 hr_utility.set_location('Entering:'||l_proc, 5);
188 --
189 -- Add any mandatory argument checking here:
190 -- Example:
191 -- hr_api.mandatory_arg_error
192 -- (p_api_name => l_proc,
193 -- p_argument => 'object_version_number',
194 -- p_argument_value => p_object_version_number);
195 --
196 Open C_Sel1;
197 Fetch C_Sel1 Into g_old_rec;
198 If C_Sel1%notfound then
199 Close C_Sel1;
200 --
201 -- The primary key is invalid therefore we must error
202 --
203 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
204 hr_utility.raise_error;
205 End If;
206 Close C_Sel1;
207 If (p_object_version_number <> g_old_rec.object_version_number) Then
208 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
209 hr_utility.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 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
223 hr_utility.set_message_token('TABLE_NAME', 'per_salary_surveys');
224 hr_utility.raise_error;
225 End lck;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |-----------------------------< convert_args >-----------------------------|
229 -- ----------------------------------------------------------------------------
230 Function convert_args
231 (
232 p_salary_survey_id in number,
233 p_object_version_number in number,
234 p_survey_name in varchar2,
235 p_survey_company_code in varchar2,
236 p_identifier in varchar2,
237 --ras-- p_currency_code in varchar2,
238 p_survey_type_code in varchar2,
239 p_base_region in varchar2,
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 l_proc varchar2(72) := g_package||'convert_args';
266 --
267 Begin
268 --
269 hr_utility.set_location('Entering:'||l_proc, 5);
270 --
271 -- Convert arguments into local l_rec structure.
272 --
273 l_rec.salary_survey_id := p_salary_survey_id;
274 l_rec.object_version_number := p_object_version_number;
275 l_rec.survey_name := p_survey_name;
276 l_rec.survey_company_code := p_survey_company_code;
277 l_rec.identifier := p_identifier;
278 --ras-- l_rec.currency_code := p_currency_code;
279 l_rec.survey_type_code := p_survey_type_code;
280 l_rec.base_region := p_base_region;
281 l_rec.attribute_category := p_attribute_category;
282 l_rec.attribute1 := p_attribute1;
283 l_rec.attribute2 := p_attribute2;
284 l_rec.attribute3 := p_attribute3;
285 l_rec.attribute4 := p_attribute4;
286 l_rec.attribute5 := p_attribute5;
287 l_rec.attribute6 := p_attribute6;
288 l_rec.attribute7 := p_attribute7;
289 l_rec.attribute8 := p_attribute8;
290 l_rec.attribute9 := p_attribute9;
291 l_rec.attribute10 := p_attribute10;
292 l_rec.attribute11 := p_attribute11;
293 l_rec.attribute12 := p_attribute12;
294 l_rec.attribute13 := p_attribute13;
295 l_rec.attribute14 := p_attribute14;
296 l_rec.attribute15 := p_attribute15;
297 l_rec.attribute16 := p_attribute16;
298 l_rec.attribute17 := p_attribute17;
299 l_rec.attribute18 := p_attribute18;
300 l_rec.attribute19 := p_attribute19;
301 l_rec.attribute20 := p_attribute20;
302 --
303 -- Return the plsql record structure.
304 --
305 hr_utility.set_location(' Leaving:'||l_proc, 10);
306 Return(l_rec);
307 --
308 End convert_args;
309 --
310 end per_pss_shd;