DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SBC_SHD

Source


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