[Home] [Help]
PACKAGE BODY: APPS.PER_GRS_SHD
Source
1 Package Body per_grs_shd as
2 /* $Header: pegrsrhi.pkb 115.3 2002/12/05 17:40:37 pkakar ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_grs_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_CAGR_GRADE_STRUCTURES_PK') 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_CAGR_GRADE_STRUCTURES_UK1') 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','5');
45 hr_utility.raise_error;
46 Else
47 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
48 hr_utility.set_message_token('PROCEDURE', l_proc);
49 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
50 hr_utility.raise_error;
51 End If;
52 --
53 hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60 (p_effective_date in date,
61 p_cagr_grade_structure_id in number,
62 p_object_version_number in number
63 ) Return Boolean Is
64 --
65 --
66 -- Cursor selects the 'current' row from the HR Schema
67 --
68 Cursor C_Sel1 is
69 select
70 cagr_grade_structure_id,
71 collective_agreement_id,
72 object_version_number,
73 id_flex_num,
74 dynamic_insert_allowed,
75 attribute_category,
76 attribute1,
77 attribute2,
78 attribute3,
79 attribute4,
80 attribute5,
81 attribute6,
82 attribute7,
83 attribute8,
84 attribute9,
85 attribute10,
86 attribute11,
87 attribute12,
88 attribute13,
89 attribute14,
90 attribute15,
91 attribute16,
92 attribute17,
93 attribute18,
94 attribute19,
95 attribute20
96 from per_cagr_grade_structures
97 where cagr_grade_structure_id = p_cagr_grade_structure_id;
98 --
99 l_proc varchar2(72) := g_package||'api_updating';
100 l_fct_ret boolean;
101 --
102 Begin
103 hr_utility.set_location('Entering:'||l_proc, 5);
104 --
105 If (
106 p_cagr_grade_structure_id is null and
107 p_object_version_number is null
108 ) Then
109 --
110 -- One of the primary key arguments is null therefore we must
111 -- set the returning function value to false
112 --
113 l_fct_ret := false;
114 Else
115 If (
116 p_cagr_grade_structure_id = g_old_rec.cagr_grade_structure_id and
117 p_object_version_number = g_old_rec.object_version_number
118 ) Then
119 hr_utility.set_location(l_proc, 10);
120 --
121 -- The g_old_rec is current therefore we must
122 -- set the returning function to true
123 --
124 l_fct_ret := true;
125 Else
126 --
127 -- Select the current row into g_old_rec
128 --
129 Open C_Sel1;
130 Fetch C_Sel1 Into g_old_rec;
131 If C_Sel1%notfound Then
132 Close C_Sel1;
133 --
134 -- The primary key is invalid therefore we must error
135 --
136 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
137 hr_utility.raise_error;
138 End If;
139 Close C_Sel1;
140 If (p_object_version_number <> g_old_rec.object_version_number) Then
141 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
142 hr_utility.raise_error;
143 End If;
144 hr_utility.set_location(l_proc, 15);
145 l_fct_ret := true;
146 End If;
147 End If;
148 hr_utility.set_location(' Leaving:'||l_proc, 20);
149 Return (l_fct_ret);
150 --
151 End api_updating;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |---------------------------------< lck >----------------------------------|
155 -- ----------------------------------------------------------------------------
156 Procedure lck
157 (p_effective_date in date,
158 p_cagr_grade_structure_id in number,
159 p_object_version_number in number
160 ) is
161 --
162 -- Cursor selects the 'current' row from the HR Schema
163 --
164 Cursor C_Sel1 is
165 select cagr_grade_structure_id,
166 collective_agreement_id,
167 object_version_number,
168 id_flex_num,
169 dynamic_insert_allowed,
170 attribute_category,
171 attribute1,
172 attribute2,
173 attribute3,
174 attribute4,
175 attribute5,
176 attribute6,
177 attribute7,
178 attribute8,
179 attribute9,
180 attribute10,
181 attribute11,
182 attribute12,
183 attribute13,
184 attribute14,
185 attribute15,
186 attribute16,
187 attribute17,
188 attribute18,
189 attribute19,
190 attribute20
191 from per_cagr_grade_structures
192 where cagr_grade_structure_id = p_cagr_grade_structure_id
193 for update nowait;
194 --
195 l_proc varchar2(72) := g_package||'lck';
196 --
197 Begin
198 hr_utility.set_location('Entering:'||l_proc, 5);
199 --
200 -- Add any mandatory argument checking here:
201 -- Example:
202 -- hr_api.mandatory_arg_error
203 -- (p_api_name => l_proc,
204 -- p_argument => 'object_version_number',
205 -- p_argument_value => p_object_version_number);
206 --
207 Open C_Sel1;
208 Fetch C_Sel1 Into g_old_rec;
209 If C_Sel1%notfound then
210 Close C_Sel1;
211 --
212 -- The primary key is invalid therefore we must error
213 --
214 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
215 hr_utility.raise_error;
216 End If;
217 Close C_Sel1;
218 If (p_object_version_number <> g_old_rec.object_version_number) Then
219 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
220 hr_utility.raise_error;
221 End If;
222 --
223 hr_utility.set_location(' Leaving:'||l_proc, 10);
224 --
225 -- We need to trap the ORA LOCK exception
226 --
227 Exception
228 When HR_Api.Object_Locked then
229 --
230 -- The object is locked therefore we need to supply a meaningful
231 -- error message.
232 --
233 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
234 hr_utility.set_message_token('TABLE_NAME', 'per_cagr_grade_structures');
235 hr_utility.raise_error;
236 End lck;
237 --
238 -- ----------------------------------------------------------------------------
239 -- |-----------------------------< convert_args >-----------------------------|
240 -- ----------------------------------------------------------------------------
241 Function convert_args
242 (
243 p_cagr_grade_structure_id in number,
244 p_collective_agreement_id in number,
245 p_object_version_number in number,
246 p_id_flex_num in number,
247 p_dynamic_insert_allowed in varchar2,
248 p_attribute_category in varchar2,
249 p_attribute1 in varchar2,
250 p_attribute2 in varchar2,
251 p_attribute3 in varchar2,
252 p_attribute4 in varchar2,
253 p_attribute5 in varchar2,
254 p_attribute6 in varchar2,
255 p_attribute7 in varchar2,
256 p_attribute8 in varchar2,
257 p_attribute9 in varchar2,
258 p_attribute10 in varchar2,
259 p_attribute11 in varchar2,
260 p_attribute12 in varchar2,
261 p_attribute13 in varchar2,
262 p_attribute14 in varchar2,
263 p_attribute15 in varchar2,
264 p_attribute16 in varchar2,
265 p_attribute17 in varchar2,
266 p_attribute18 in varchar2,
267 p_attribute19 in varchar2,
268 p_attribute20 in varchar2
269 )
270 Return g_rec_type is
271 --
272 l_rec g_rec_type;
273 l_proc varchar2(72) := g_package||'convert_args';
274 --
275 Begin
276 --
277 hr_utility.set_location('Entering:'||l_proc, 5);
278 --
279 -- Convert arguments into local l_rec structure.
280 --
281 l_rec.cagr_grade_structure_id := p_cagr_grade_structure_id;
282 l_rec.collective_agreement_id := p_collective_agreement_id;
283 l_rec.object_version_number := p_object_version_number;
284 l_rec.id_flex_num := p_id_flex_num;
285 l_rec.dynamic_insert_allowed := p_dynamic_insert_allowed;
286 l_rec.attribute_category := p_attribute_category;
287 l_rec.attribute1 := p_attribute1;
288 l_rec.attribute2 := p_attribute2;
289 l_rec.attribute3 := p_attribute3;
290 l_rec.attribute4 := p_attribute4;
291 l_rec.attribute5 := p_attribute5;
292 l_rec.attribute6 := p_attribute6;
293 l_rec.attribute7 := p_attribute7;
294 l_rec.attribute8 := p_attribute8;
295 l_rec.attribute9 := p_attribute9;
296 l_rec.attribute10 := p_attribute10;
297 l_rec.attribute11 := p_attribute11;
298 l_rec.attribute12 := p_attribute12;
299 l_rec.attribute13 := p_attribute13;
300 l_rec.attribute14 := p_attribute14;
301 l_rec.attribute15 := p_attribute15;
302 l_rec.attribute16 := p_attribute16;
303 l_rec.attribute17 := p_attribute17;
304 l_rec.attribute18 := p_attribute18;
305 l_rec.attribute19 := p_attribute19;
306 l_rec.attribute20 := p_attribute20;
307 --
308 -- Return the plsql record structure.
309 --
310 hr_utility.set_location(' Leaving:'||l_proc, 10);
311 Return(l_rec);
312 --
313 End convert_args;
314 --
315 end per_grs_shd;