[Home] [Help]
PACKAGE BODY: APPS.PAY_SSR_SHD
Source
1 Package Body pay_ssr_shd as
2 /* $Header: pyssrrhi.pkb 120.0 2005/05/29 08:55:13 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_ssr_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 = 'PAY_SHADOW_SUB_CLASSI_RULE_FK1') 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 = 'PAY_SHADOW_SUB_CLASSI_RULE_PK') Then
27 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
28 hr_utility.set_message_token('PROCEDURE', l_proc);
29 hr_utility.set_message_token('STEP','10');
30 hr_utility.raise_error;
31 Else
32 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
33 hr_utility.set_message_token('PROCEDURE', l_proc);
34 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
35 hr_utility.raise_error;
36 End If;
37 --
38 hr_utility.set_location(' Leaving:'||l_proc, 10);
39 End constraint_error;
40 --
41 -- ----------------------------------------------------------------------------
42 -- |-----------------------------< api_updating >-----------------------------|
43 -- ----------------------------------------------------------------------------
44 Function api_updating
45 (
46 p_sub_classification_rule_id in number,
47 p_object_version_number in number
48 ) Return Boolean Is
49 --
50 --
51 -- Cursor selects the 'current' row from the HR Schema
52 --
53 Cursor C_Sel1 is
54 select
55 sub_classification_rule_id,
56 element_type_id,
57 element_classification,
58 object_version_number
59 , exclusion_rule_id
60 from pay_shadow_sub_classi_rules
61 where sub_classification_rule_id = p_sub_classification_rule_id;
62 --
63 l_proc varchar2(72) := g_package||'api_updating';
64 l_fct_ret boolean;
65 --
66 Begin
67 hr_utility.set_location('Entering:'||l_proc, 5);
68 --
69 If (
70 p_sub_classification_rule_id is null and
71 p_object_version_number is null
72 ) Then
73 --
74 -- One of the primary key arguments is null therefore we must
75 -- set the returning function value to false
76 --
77 l_fct_ret := false;
78 Else
79 If (
80 p_sub_classification_rule_id = g_old_rec.sub_classification_rule_id and
81 p_object_version_number = g_old_rec.object_version_number
82 ) Then
83 hr_utility.set_location(l_proc, 10);
84 --
85 -- The g_old_rec is current therefore we must
86 -- set the returning function to true
87 --
88 l_fct_ret := true;
89 Else
90 --
91 -- Select the current row into g_old_rec
92 --
93 Open C_Sel1;
94 Fetch C_Sel1 Into g_old_rec;
95 If C_Sel1%notfound Then
96 Close C_Sel1;
97 --
98 -- The primary key is invalid therefore we must error
99 --
100 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
101 hr_utility.raise_error;
102 End If;
103 Close C_Sel1;
104 If (p_object_version_number <> g_old_rec.object_version_number) Then
105 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
106 hr_utility.raise_error;
107 End If;
108 hr_utility.set_location(l_proc, 15);
109 l_fct_ret := true;
110 End If;
111 End If;
112 hr_utility.set_location(' Leaving:'||l_proc, 20);
113 Return (l_fct_ret);
114 --
115 End api_updating;
116 --
117 -- ----------------------------------------------------------------------------
118 -- |---------------------------------< lck >----------------------------------|
119 -- ----------------------------------------------------------------------------
120 Procedure lck
121 (
122 p_sub_classification_rule_id in number,
123 p_object_version_number in number
124 ) is
125 --
126 -- Cursor selects the 'current' row from the HR Schema
127 --
128 Cursor C_Sel1 is
129 select sub_classification_rule_id,
130 element_type_id,
131 element_classification,
132 object_version_number
133 , exclusion_rule_id
134 from pay_shadow_sub_classi_rules
135 where sub_classification_rule_id = p_sub_classification_rule_id
136 for update nowait;
137 --
138 l_proc varchar2(72) := g_package||'lck';
139 --
140 Begin
141 hr_utility.set_location('Entering:'||l_proc, 5);
142 --
143 hr_api.mandatory_arg_error
144 (p_api_name => l_proc,
145 p_argument => 'p_sub_classification_rule_id',
146 p_argument_value => p_sub_classification_rule_id);
147 hr_api.mandatory_arg_error
148 (p_api_name => l_proc,
149 p_argument => 'p_object_version_number',
150 p_argument_value => p_object_version_number);
151 Open C_Sel1;
152 Fetch C_Sel1 Into g_old_rec;
153 If C_Sel1%notfound then
154 Close C_Sel1;
155 --
156 -- The primary key is invalid therefore we must error
157 --
158 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
159 hr_utility.raise_error;
160 End If;
161 Close C_Sel1;
162 If (p_object_version_number <> g_old_rec.object_version_number) Then
163 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
164 hr_utility.raise_error;
165 End If;
166 --
167 hr_utility.set_location(' Leaving:'||l_proc, 10);
168 --
169 -- We need to trap the ORA LOCK exception
170 --
171 Exception
172 When HR_Api.Object_Locked then
173 --
174 -- The object is locked therefore we need to supply a meaningful
175 -- error message.
176 --
177 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
178 hr_utility.set_message_token('TABLE_NAME', 'pay_shadow_sub_classi_rules');
179 hr_utility.raise_error;
180 End lck;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |-----------------------------< convert_args >-----------------------------|
184 -- ----------------------------------------------------------------------------
185 Function convert_args
186 (
187 p_sub_classification_rule_id in number,
188 p_element_type_id in number,
189 p_element_classification in varchar2,
190 p_object_version_number in number
191 ,p_exclusion_rule_id in number
192 )
193 Return g_rec_type is
194 --
195 l_rec g_rec_type;
196 l_proc varchar2(72) := g_package||'convert_args';
197 --
198 Begin
199 --
200 hr_utility.set_location('Entering:'||l_proc, 5);
201 --
202 -- Convert arguments into local l_rec structure.
203 --
204 l_rec.sub_classification_rule_id := p_sub_classification_rule_id;
205 l_rec.element_type_id := p_element_type_id;
206 l_rec.element_classification := p_element_classification;
207 l_rec.object_version_number := p_object_version_number;
208 l_rec.exclusion_rule_id := p_exclusion_rule_id;
209 --
210 -- Return the plsql record structure.
211 --
212 hr_utility.set_location(' Leaving:'||l_proc, 10);
213 Return(l_rec);
214 --
215 End convert_args;
216 --
217 end pay_ssr_shd;