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