[Home] [Help]
PACKAGE BODY: APPS.PER_GRA_SHD
Source
1 Package Body per_gra_shd as
2 /* $Header: pegrarhi.pkb 115.4 2003/08/31 00:48:34 kjagadee ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_gra_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_GRADES_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_GRADES_UK1') Then
42 hr_utility.set_message(0, 'FORM_DUPLICATE_KEY_IN_INDEX');
43 hr_utility.raise_error;
44 Else
45 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
46 hr_utility.set_message_token('PROCEDURE', l_proc);
47 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
48 hr_utility.raise_error;
49 End If;
50 --
51 hr_utility.set_location(' Leaving:'||l_proc, 10);
52 End constraint_error;
53 --
54 -- ----------------------------------------------------------------------------
55 -- |-----------------------------< api_updating >-----------------------------|
56 -- ----------------------------------------------------------------------------
57 Function api_updating
58 (p_cagr_grade_id in number,
59 p_object_version_number in number,
60 p_effective_date in date
61 ) Return Boolean Is
62 --
63 --
64 -- Cursor selects the 'current' row from the HR Schema
65 --
66 Cursor C_Sel1 is
67 select
68 cagr_grade_id,
69 cagr_grade_structure_id,
70 cagr_grade_def_id,
71 sequence,
72 object_version_number
73 from per_cagr_grades
74 where cagr_grade_id = p_cagr_grade_id;
75 --
76 l_proc varchar2(72) := g_package||'api_updating';
77 l_fct_ret boolean;
78 --
79 Begin
80 hr_utility.set_location('Entering:'||l_proc, 5);
81 --
82 If (
83 p_cagr_grade_id is null and
84 p_object_version_number is null
85 ) Then
86 --
87 -- One of the primary key arguments is null therefore we must
88 -- set the returning function value to false
89 --
90 l_fct_ret := false;
91 Else
92 If (
93 p_cagr_grade_id = g_old_rec.cagr_grade_id and
94 p_object_version_number = g_old_rec.object_version_number
95 ) Then
96 hr_utility.set_location(l_proc, 10);
97 --
98 -- The g_old_rec is current therefore we must
99 -- set the returning function to true
100 --
101 l_fct_ret := true;
102 Else
103 --
104 -- Select the current row into g_old_rec
105 --
106 Open C_Sel1;
107 Fetch C_Sel1 Into g_old_rec;
108 If C_Sel1%notfound Then
109 Close C_Sel1;
110 --
111 -- The primary key is invalid therefore we must error
112 --
113 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
114 hr_utility.raise_error;
115 End If;
116 Close C_Sel1;
117 If (p_object_version_number <> g_old_rec.object_version_number) Then
118 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
119 hr_utility.raise_error;
120 End If;
121 hr_utility.set_location(l_proc, 15);
122 l_fct_ret := true;
123 End If;
124 End If;
125 hr_utility.set_location(' Leaving:'||l_proc, 20);
126 Return (l_fct_ret);
127 --
128 End api_updating;
129 --
130 -- ----------------------------------------------------------------------------
131 -- |---------------------------------< lck >----------------------------------|
132 -- ----------------------------------------------------------------------------
133 Procedure lck
134 (p_cagr_grade_id in number,
135 p_object_version_number in number,
136 p_effective_date in date
137 ) is
138 --
139 -- Cursor selects the 'current' row from the HR Schema
140 --
141 Cursor C_Sel1 is
142 select cagr_grade_id,
143 cagr_grade_structure_id,
144 cagr_grade_def_id,
145 sequence,
146 object_version_number
147 from per_cagr_grades
148 where cagr_grade_id = p_cagr_grade_id
149 for update nowait;
150 --
151 l_proc varchar2(72) := g_package||'lck';
152 --
153 Begin
154 hr_utility.set_location('Entering:'||l_proc, 5);
155 --
156 -- Add any mandatory argument checking here:
157 -- Example:
158 -- hr_api.mandatory_arg_error
159 -- (p_api_name => l_proc,
160 -- p_argument => 'object_version_number',
161 -- p_argument_value => p_object_version_number);
162 --
163 hr_api.mandatory_arg_error
164 (p_api_name => l_proc,
165 p_argument => 'cagr_grade_id',
166 p_argument_value => p_cagr_grade_id);
167 --
168 hr_utility.set_location(l_proc,10);
169 --
170 hr_api.mandatory_arg_error
171 (p_api_name => l_proc,
172 p_argument => 'object_version_number',
173 p_argument_value => p_object_version_number);
174 --
175 hr_utility.set_location(l_proc,15);
176 --
177 Open C_Sel1;
178 Fetch C_Sel1 Into g_old_rec;
179 If C_Sel1%notfound then
180 Close C_Sel1;
181 --
182 -- The primary key is invalid therefore we must error
183 --
184 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
185 hr_utility.raise_error;
186 End If;
187 Close C_Sel1;
188 If (p_object_version_number <> g_old_rec.object_version_number) Then
189 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
190 hr_utility.raise_error;
191 End If;
192 --
193 hr_utility.set_location(' Leaving:'||l_proc, 20);
194 --
195 -- We need to trap the ORA LOCK exception
196 --
197 Exception
198 When HR_Api.Object_Locked then
199 --
200 -- The object is locked therefore we need to supply a meaningful
201 -- error message.
202 --
203 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
204 hr_utility.set_message_token('TABLE_NAME', 'per_cagr_grades');
205 hr_utility.raise_error;
206 End lck;
207 --
208 -- ----------------------------------------------------------------------------
209 -- |-----------------------------< convert_args >-----------------------------|
210 -- ----------------------------------------------------------------------------
211 Function convert_args
212 (
213 p_cagr_grade_id in number,
214 p_cagr_grade_structure_id in number,
215 p_cagr_grade_def_id in number,
216 p_sequence in number,
217 p_object_version_number in number
218 )
219 Return g_rec_type is
220 --
221 l_rec g_rec_type;
222 l_proc varchar2(72) := g_package||'convert_args';
223 --
224 Begin
225 --
226 hr_utility.set_location('Entering:'||l_proc, 5);
227 --
228 -- Convert arguments into local l_rec structure.
229 --
230 l_rec.cagr_grade_id := p_cagr_grade_id;
231 l_rec.cagr_grade_structure_id := p_cagr_grade_structure_id;
232 l_rec.cagr_grade_def_id := p_cagr_grade_def_id;
233 l_rec.sequence := p_sequence;
234 l_rec.object_version_number := p_object_version_number;
235 --
236 -- Return the plsql record structure.
237 --
238 hr_utility.set_location(' Leaving:'||l_proc, 10);
239 Return(l_rec);
240 --
241 End convert_args;
242 --
243 end per_gra_shd;