DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SIV_SHD

Source


1 Package Body pay_siv_shd as
2 /* $Header: pysivrhi.pkb 120.0 2005/05/29 08:52:40 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_siv_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_INPUT_VALUES_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_INPUT_VALUES_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_INPUT_VALUES_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_input_value_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 	input_value_id,
61 	element_type_id,
62 	display_sequence,
63 	generate_db_items_flag,
64 	hot_default_flag,
65 	mandatory_flag,
66 	name,
67 	uom,
68 	lookup_type,
69 	default_value,
70 	max_value,
71 	min_value,
72 	warning_or_error,
73 	default_value_column,
74 	exclusion_rule_id,
75 	formula_id,
76 	input_validation_formula,
77 	object_version_number
78     from	pay_shadow_input_values
79     where	input_value_id = p_input_value_id;
80 --
81   l_proc	varchar2(72)	:= g_package||'api_updating';
82   l_fct_ret	boolean;
83 --
84 Begin
85   hr_utility.set_location('Entering:'||l_proc, 5);
86   --
87   If (
88 	p_input_value_id is null and
89 	p_object_version_number is null
90      ) Then
91     --
92     -- One of the primary key arguments is null therefore we must
93     -- set the returning function value to false
94     --
95     l_fct_ret := false;
96   Else
97     If (
98 	p_input_value_id = g_old_rec.input_value_id and
99 	p_object_version_number = g_old_rec.object_version_number
100        ) Then
101       hr_utility.set_location(l_proc, 10);
102       --
103       -- The g_old_rec is current therefore we must
104       -- set the returning function to true
105       --
106       l_fct_ret := true;
107     Else
108       --
109       -- Select the current row into g_old_rec
110       --
111       Open C_Sel1;
112       Fetch C_Sel1 Into g_old_rec;
113       If C_Sel1%notfound Then
114         Close C_Sel1;
115         --
116         -- The primary key is invalid therefore we must error
117         --
118         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
119         hr_utility.raise_error;
120       End If;
121       Close C_Sel1;
122       If (p_object_version_number <> g_old_rec.object_version_number) Then
123         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
124         hr_utility.raise_error;
125       End If;
126       hr_utility.set_location(l_proc, 15);
127       l_fct_ret := true;
128     End If;
129   End If;
130   hr_utility.set_location(' Leaving:'||l_proc, 20);
131   Return (l_fct_ret);
132 --
133 End api_updating;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |---------------------------------< lck >----------------------------------|
137 -- ----------------------------------------------------------------------------
138 Procedure lck
139   (
140   p_input_value_id                     in number,
141   p_object_version_number              in number
142   ) is
143 --
144 -- Cursor selects the 'current' row from the HR Schema
145 --
146   Cursor C_Sel1 is
147     select 	input_value_id,
148 	element_type_id,
149 	display_sequence,
150 	generate_db_items_flag,
151 	hot_default_flag,
152 	mandatory_flag,
153 	name,
154 	uom,
155 	lookup_type,
156 	default_value,
157 	max_value,
158 	min_value,
159 	warning_or_error,
160 	default_value_column,
161 	exclusion_rule_id,
162 	formula_id,
163 	input_validation_formula,
164 	object_version_number
165     from	pay_shadow_input_values
166     where	input_value_id = p_input_value_id
167     for	update nowait;
168 --
169   l_proc	varchar2(72) := g_package||'lck';
170 --
171 Begin
172   hr_utility.set_location('Entering:'||l_proc, 5);
173   --
174   -- Add any mandatory argument checking here:
175   -- Example:
176   hr_api.mandatory_arg_error
177     (p_api_name       => l_proc,
178      p_argument       => 'p_input_value_id',
179      p_argument_value => p_input_value_id);
180   hr_api.mandatory_arg_error
181     (p_api_name       => l_proc,
182      p_argument       => 'p_object_version_number',
183      p_argument_value => p_object_version_number);
184   Open  C_Sel1;
185   Fetch C_Sel1 Into g_old_rec;
186   If C_Sel1%notfound then
187     Close C_Sel1;
188     --
189     -- The primary key is invalid therefore we must error
190     --
191     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
192     hr_utility.raise_error;
193   End If;
194   Close C_Sel1;
195   If (p_object_version_number <> g_old_rec.object_version_number) Then
196         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
197         hr_utility.raise_error;
198       End If;
199 --
200   hr_utility.set_location(' Leaving:'||l_proc, 10);
201 --
202 -- We need to trap the ORA LOCK exception
203 --
204 Exception
205   When HR_Api.Object_Locked then
206     --
207     -- The object is locked therefore we need to supply a meaningful
208     -- error message.
209     --
210     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
211     hr_utility.set_message_token('TABLE_NAME', 'pay_shadow_input_values');
212     hr_utility.raise_error;
213 End lck;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |-----------------------------< convert_args >-----------------------------|
217 -- ----------------------------------------------------------------------------
218 Function convert_args
219 	(
220 	p_input_value_id                in number,
221 	p_element_type_id               in number,
222 	p_display_sequence              in number,
223 	p_generate_db_items_flag        in varchar2,
224 	p_hot_default_flag              in varchar2,
225 	p_mandatory_flag                in varchar2,
226 	p_name                          in varchar2,
227 	p_uom                           in varchar2,
228 	p_lookup_type                   in varchar2,
229 	p_default_value                 in varchar2,
230 	p_max_value                     in varchar2,
231 	p_min_value                     in varchar2,
232 	p_warning_or_error              in varchar2,
233 	p_default_value_column          in varchar2,
234 	p_exclusion_rule_id             in number,
235 	p_formula_id			in number,
236 	p_input_validation_formula	in varchar2,
237 	p_object_version_number         in number
238 	)
239 	Return g_rec_type is
240 --
241   l_rec	  g_rec_type;
242   l_proc  varchar2(72) := g_package||'convert_args';
243 --
244 Begin
245   --
246   hr_utility.set_location('Entering:'||l_proc, 5);
247   --
248   -- Convert arguments into local l_rec structure.
249   --
250   l_rec.input_value_id                   := p_input_value_id;
251   l_rec.element_type_id                  := p_element_type_id;
252   l_rec.display_sequence                 := p_display_sequence;
253   l_rec.generate_db_items_flag           := p_generate_db_items_flag;
254   l_rec.hot_default_flag                 := p_hot_default_flag;
255   l_rec.mandatory_flag                   := p_mandatory_flag;
256   l_rec.name                             := p_name;
257   l_rec.uom                              := p_uom;
258   l_rec.lookup_type                      := p_lookup_type;
259   l_rec.default_value                    := p_default_value;
260   l_rec.max_value                        := p_max_value;
261   l_rec.min_value                        := p_min_value;
262   l_rec.warning_or_error                 := p_warning_or_error;
263   l_rec.default_value_column             := p_default_value_column;
264   l_rec.exclusion_rule_id                := p_exclusion_rule_id;
265   l_rec.formula_id			 := p_formula_id;
266   l_rec.input_validation_formula	 := p_input_validation_formula;
267   l_rec.object_version_number            := p_object_version_number;
268   --
269   -- Return the plsql record structure.
270   --
271   hr_utility.set_location(' Leaving:'||l_proc, 10);
272   Return(l_rec);
273 --
274 End convert_args;
275 --
276 end pay_siv_shd;