[Home] [Help]
PACKAGE BODY: APPS.PQH_BST_SHD
Source
1 Package Body pqh_bst_shd as
2 /* $Header: pqbstrhi.pkb 115.7 2002/12/05 19:30:15 rpasapul ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_bst_shd.'; -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 hr_utility.set_location('Entering:'||l_proc, 5);
21 --
22 If (p_constraint_name = 'PQH_BUDGET_SETS_FK1') Then
23 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
24 hr_utility.set_message_token('PROCEDURE', l_proc);
25 hr_utility.set_message_token('STEP','5');
26 hr_utility.raise_error;
27 ElsIf (p_constraint_name = 'PQH_BUDGET_SETS_FK2') Then
28 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
29 hr_utility.set_message_token('PROCEDURE', l_proc);
30 hr_utility.set_message_token('STEP','10');
31 hr_utility.raise_error;
32 ElsIf (p_constraint_name = 'PQH_BUDGET_SETS_PK') Then
33 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
34 hr_utility.set_message_token('PROCEDURE', l_proc);
35 hr_utility.set_message_token('STEP','15');
36 hr_utility.raise_error;
37 ElsIf (p_constraint_name = 'PQH_BUDGET_SETS_UK') Then
38 hr_utility.set_message(8302, 'PQH_DUPLICATE_BUDGET_SET_NAME');
39 hr_utility.raise_error;
40 Else
41 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
42 hr_utility.set_message_token('PROCEDURE', l_proc);
43 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
44 hr_utility.raise_error;
45 End If;
46 --
47 hr_utility.set_location(' Leaving:'||l_proc, 10);
48 End constraint_error;
49 --
50 -- ----------------------------------------------------------------------------
51 -- |-----------------------------< api_updating >-----------------------------|
52 -- ----------------------------------------------------------------------------
53 Function api_updating
54 (
55 p_budget_set_id in number,
56 p_object_version_number in number
57 ) Return Boolean Is
58 --
59 --
60 -- Cursor selects the 'current' row from the HR Schema
61 --
62 Cursor C_Sel1 is
63 select
64 budget_set_id,
65 dflt_budget_set_id,
66 budget_period_id,
67 budget_unit1_percent,
68 budget_unit2_percent,
69 budget_unit3_percent,
70 budget_unit1_value,
71 budget_unit2_value,
72 budget_unit3_value,
73 budget_unit1_available,
74 budget_unit2_available,
75 budget_unit3_available,
76 object_version_number,
77 budget_unit1_value_type_cd,
78 budget_unit2_value_type_cd,
79 budget_unit3_value_type_cd
80 from pqh_budget_sets
81 where budget_set_id = p_budget_set_id;
82 --
83 l_proc varchar2(72) := g_package||'api_updating';
84 l_fct_ret boolean;
85 --
86 Begin
87 hr_utility.set_location('Entering:'||l_proc, 5);
88 --
89 If (
90 p_budget_set_id is null and
91 p_object_version_number is null
92 ) Then
93 --
94 -- One of the primary key arguments is null therefore we must
95 -- set the returning function value to false
96 --
97 l_fct_ret := false;
98 Else
99 If (
100 p_budget_set_id = g_old_rec.budget_set_id and
101 p_object_version_number = g_old_rec.object_version_number
102 ) Then
103 hr_utility.set_location(l_proc, 10);
104 --
105 -- The g_old_rec is current therefore we must
106 -- set the returning function to true
107 --
108 l_fct_ret := true;
109 Else
110 --
111 -- Select the current row into g_old_rec
112 --
113 Open C_Sel1;
114 Fetch C_Sel1 Into g_old_rec;
115 If C_Sel1%notfound Then
116 Close C_Sel1;
117 --
118 -- The primary key is invalid therefore we must error
119 --
120 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
121 hr_utility.raise_error;
122 End If;
123 Close C_Sel1;
124 If (p_object_version_number <> g_old_rec.object_version_number) Then
125 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
126 hr_utility.raise_error;
127 End If;
128 hr_utility.set_location(l_proc, 15);
129 l_fct_ret := true;
130 End If;
131 End If;
132 hr_utility.set_location(' Leaving:'||l_proc, 20);
133 Return (l_fct_ret);
134 --
135 End api_updating;
136 --
137 -- ----------------------------------------------------------------------------
138 -- |---------------------------------< lck >----------------------------------|
139 -- ----------------------------------------------------------------------------
140 Procedure lck
141 (
142 p_budget_set_id in number,
143 p_object_version_number in number
144 ) is
145 --
146 -- Cursor selects the 'current' row from the HR Schema
147 --
148 Cursor C_Sel1 is
149 select budget_set_id,
150 dflt_budget_set_id,
151 budget_period_id,
152 budget_unit1_percent,
153 budget_unit2_percent,
154 budget_unit3_percent,
155 budget_unit1_value,
156 budget_unit2_value,
157 budget_unit3_value,
158 budget_unit1_available,
159 budget_unit2_available,
160 budget_unit3_available,
161 object_version_number,
162 budget_unit1_value_type_cd,
163 budget_unit2_value_type_cd,
164 budget_unit3_value_type_cd
165 from pqh_budget_sets
166 where budget_set_id = p_budget_set_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 => 'object_version_number',
179 -- p_argument_value => p_object_version_number);
180 --
181 Open C_Sel1;
182 Fetch C_Sel1 Into g_old_rec;
183 If C_Sel1%notfound then
184 Close C_Sel1;
185 --
186 -- The primary key is invalid therefore we must error
187 --
188 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
189 hr_utility.raise_error;
190 End If;
191 Close C_Sel1;
192 If (p_object_version_number <> g_old_rec.object_version_number) Then
193 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
194 hr_utility.raise_error;
195 End If;
196 --
197 hr_utility.set_location(' Leaving:'||l_proc, 10);
198 --
199 -- We need to trap the ORA LOCK exception
200 --
201 Exception
202 When HR_Api.Object_Locked then
203 --
204 -- The object is locked therefore we need to supply a meaningful
205 -- error message.
206 --
207 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
208 hr_utility.set_message_token('TABLE_NAME', 'pqh_budget_sets');
209 hr_utility.raise_error;
210 End lck;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |-----------------------------< convert_args >-----------------------------|
214 -- ----------------------------------------------------------------------------
215 Function convert_args
216 (
217 p_budget_set_id in number,
218 p_dflt_budget_set_id in number,
219 p_budget_period_id in number,
220 p_budget_unit1_percent in number,
221 p_budget_unit2_percent in number,
222 p_budget_unit3_percent in number,
223 p_budget_unit1_value in number,
224 p_budget_unit2_value in number,
225 p_budget_unit3_value in number,
226 p_budget_unit1_available in number,
227 p_budget_unit2_available in number,
228 p_budget_unit3_available in number,
229 p_object_version_number in number,
230 p_budget_unit1_value_type_cd in varchar2,
231 p_budget_unit2_value_type_cd in varchar2,
232 p_budget_unit3_value_type_cd in varchar2
233 )
234 Return g_rec_type is
235 --
236 l_rec g_rec_type;
237 l_proc varchar2(72) := g_package||'convert_args';
238 --
239 Begin
240 --
241 hr_utility.set_location('Entering:'||l_proc, 5);
242 --
243 -- Convert arguments into local l_rec structure.
244 --
245 l_rec.budget_set_id := p_budget_set_id;
246 l_rec.dflt_budget_set_id := p_dflt_budget_set_id;
247 l_rec.budget_period_id := p_budget_period_id;
248 l_rec.budget_unit1_percent := p_budget_unit1_percent;
249 l_rec.budget_unit2_percent := p_budget_unit2_percent;
250 l_rec.budget_unit3_percent := p_budget_unit3_percent;
251 l_rec.budget_unit1_value := p_budget_unit1_value;
252 l_rec.budget_unit2_value := p_budget_unit2_value;
253 l_rec.budget_unit3_value := p_budget_unit3_value;
254 l_rec.budget_unit1_available := p_budget_unit1_available;
255 l_rec.budget_unit2_available := p_budget_unit2_available;
256 l_rec.budget_unit3_available := p_budget_unit3_available;
257 l_rec.object_version_number := p_object_version_number;
258 l_rec.budget_unit1_value_type_cd := p_budget_unit1_value_type_cd;
259 l_rec.budget_unit2_value_type_cd := p_budget_unit2_value_type_cd;
260 l_rec.budget_unit3_value_type_cd := p_budget_unit3_value_type_cd;
261 --
262 -- Return the plsql record structure.
263 --
264 hr_utility.set_location(' Leaving:'||l_proc, 10);
265 Return(l_rec);
266 --
267 End convert_args;
268 --
269 end pqh_bst_shd;