DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SBF_SHD

Source


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