[Home] [Help]
PACKAGE BODY: APPS.PAY_PWA_SHD
Source
1 Package Body pay_pwa_shd as
2 /* $Header: pypwarhi.pkb 115.2 2002/12/05 14:25:59 swinton noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_pwa_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'PAY_WCI_ACCOUNTS_PK') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41 Else
42 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
45 hr_utility.raise_error;
46 End If;
47 --
48 hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55 (
56 p_account_id in number,
57 p_object_version_number in number
58 ) Return Boolean Is
59 --
60 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 account_id,
66 business_group_id,
67 carrier_id,
68 location_id,
69 name,
70 account_number,
71 comments,
72 object_version_number
73 from pay_wci_accounts
74 where account_id = p_account_id;
75 --
76 l_proc varchar2(72) := g_package||'api_updating';
77 l_fct_ret boolean;
78 --
79 Begin
80 hr_utility.set_location('Entering:'||l_proc, 5);
81 --
82 If (
83 p_account_id is null and
84 p_object_version_number is null
85 ) Then
86 --
87 -- One of the primary key arguments is null therefore we must
88 -- set the returning function value to false
89 --
90 l_fct_ret := false;
91 Else
92 If (
93 p_account_id = g_old_rec.account_id and
94 p_object_version_number = g_old_rec.object_version_number
95 ) Then
96 hr_utility.set_location(l_proc, 10);
97 --
98 -- The g_old_rec is current therefore we must
99 -- set the returning function to true
100 --
101 l_fct_ret := true;
102 Else
103 --
104 -- Select the current row into g_old_rec
105 --
106 Open C_Sel1;
107 Fetch C_Sel1 Into g_old_rec;
108 If C_Sel1%notfound Then
109 Close C_Sel1;
110 --
111 -- The primary key is invalid therefore we must error
112 --
113 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
114 hr_utility.raise_error;
115 End If;
116 Close C_Sel1;
117 If (p_object_version_number <> g_old_rec.object_version_number) Then
118 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
119 hr_utility.raise_error;
120 End If;
121 hr_utility.set_location(l_proc, 15);
122 l_fct_ret := true;
123 End If;
124 End If;
125 hr_utility.set_location(' Leaving:'||l_proc, 20);
126 Return (l_fct_ret);
127 --
128 End api_updating;
129 --
130 -- ----------------------------------------------------------------------------
131 -- |---------------------------------< lck >----------------------------------|
132 -- ----------------------------------------------------------------------------
133 Procedure lck
134 (
135 p_account_id in number,
136 p_object_version_number in number
137 ) is
138 --
139 -- Cursor selects the 'current' row from the HR Schema
140 --
141 Cursor C_Sel1 is
142 select account_id,
143 business_group_id,
144 carrier_id,
145 location_id,
146 name,
147 account_number,
148 comments,
149 object_version_number
150 from pay_wci_accounts
151 where account_id = p_account_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', 'pay_wci_accounts');
194 hr_utility.raise_error;
195 End lck;
196 --
197 -- ----------------------------------------------------------------------------
198 -- |-----------------------------< convert_args >-----------------------------|
199 -- ----------------------------------------------------------------------------
200 Function convert_args
201 (
202 p_account_id in number,
203 p_business_group_id in number,
204 p_carrier_id in number,
205 p_location_id in number,
206 p_name in varchar2,
207 p_account_number in varchar2,
208 p_comments in varchar2,
209 p_object_version_number in number
210 )
211 Return g_rec_type is
212 --
213 l_rec g_rec_type;
214 l_proc varchar2(72) := g_package||'convert_args';
215 --
216 Begin
217 --
218 hr_utility.set_location('Entering:'||l_proc, 5);
219 --
220 -- Convert arguments into local l_rec structure.
221 --
222 l_rec.account_id := p_account_id;
223 l_rec.business_group_id := p_business_group_id;
224 l_rec.carrier_id := p_carrier_id;
225 l_rec.location_id := p_location_id;
226 l_rec.name := p_name;
227 l_rec.account_number := p_account_number;
228 l_rec.comments := p_comments;
229 l_rec.object_version_number := p_object_version_number;
230 --
231 -- Return the plsql record structure.
232 --
233 hr_utility.set_location(' Leaving:'||l_proc, 10);
234 Return(l_rec);
235 --
236 End convert_args;
237 --
238 end pay_pwa_shd;