[Home] [Help]
PACKAGE BODY: APPS.BEN_OLA_SHD
Source
1 Package Body ben_ola_shd as
2 /* $Header: beolarhi.pkb 120.0 2005/05/28 09:51:12 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_ola_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 = 'BEN_CSR_ACTIVITIES_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_csr_activities_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 csr_activities_id,
66 ordr_num,
67 function_name,
68 user_function_name,
69 function_type,
70 business_group_id,
71 object_version_number,
72 start_date,
73 end_date
74 from ben_csr_activities
75 where csr_activities_id = p_csr_activities_id;
76 --
77 l_proc varchar2(72) := g_package||'api_updating';
78 l_fct_ret boolean;
79 --
80 Begin
81 hr_utility.set_location('Entering:'||l_proc, 5);
82 --
83 If (
84 p_csr_activities_id is null and
85 p_object_version_number is null
86 ) Then
87 --
88 -- One of the primary key arguments is null therefore we must
89 -- set the returning function value to false
90 --
91 l_fct_ret := false;
92 Else
93 If (
94 p_csr_activities_id = g_old_rec.csr_activities_id and
95 p_object_version_number = g_old_rec.object_version_number
96 ) Then
97 hr_utility.set_location(l_proc, 10);
98 --
99 -- The g_old_rec is current therefore we must
100 -- set the returning function to true
101 --
102 l_fct_ret := true;
103 Else
104 --
105 -- Select the current row into g_old_rec
106 --
107 Open C_Sel1;
108 Fetch C_Sel1 Into g_old_rec;
109 If C_Sel1%notfound Then
110 Close C_Sel1;
111 --
112 -- The primary key is invalid therefore we must error
113 --
114 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
115 hr_utility.raise_error;
116 End If;
117 Close C_Sel1;
118 If (p_object_version_number <> g_old_rec.object_version_number) Then
119 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
120 hr_utility.raise_error;
121 End If;
122 hr_utility.set_location(l_proc, 15);
123 l_fct_ret := true;
124 End If;
128 --
125 End If;
126 hr_utility.set_location(' Leaving:'||l_proc, 20);
127 Return (l_fct_ret);
129 End api_updating;
130 --
131 -- ----------------------------------------------------------------------------
132 -- |---------------------------------< lck >----------------------------------|
133 -- ----------------------------------------------------------------------------
134 Procedure lck
135 (
136 p_csr_activities_id in number,
137 p_object_version_number in number
138 ) is
139 --
140 -- Cursor selects the 'current' row from the HR Schema
141 --
142 Cursor C_Sel1 is
143 select csr_activities_id,
144 ordr_num,
145 function_name,
146 user_function_name,
147 function_type,
148 business_group_id,
149 object_version_number,
150 start_date,
151 end_date
152 from ben_csr_activities
153 where csr_activities_id = p_csr_activities_id
154 for update nowait;
155 --
156 l_proc varchar2(72) := g_package||'lck';
157 --
158 Begin
159 hr_utility.set_location('Entering:'||l_proc, 5);
160 --
161 -- Add any mandatory argument checking here:
162 -- Example:
163 -- hr_api.mandatory_arg_error
164 -- (p_api_name => l_proc,
165 -- p_argument => 'object_version_number',
166 -- p_argument_value => p_object_version_number);
167 --
168 Open C_Sel1;
169 Fetch C_Sel1 Into g_old_rec;
170 If C_Sel1%notfound then
171 Close C_Sel1;
172 --
173 -- The primary key is invalid therefore we must error
174 --
175 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
176 hr_utility.raise_error;
177 End If;
178 Close C_Sel1;
179 If (p_object_version_number <> g_old_rec.object_version_number) Then
180 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
181 hr_utility.raise_error;
182 End If;
183 --
184 hr_utility.set_location(' Leaving:'||l_proc, 10);
185 --
186 -- We need to trap the ORA LOCK exception
187 --
188 Exception
189 When HR_Api.Object_Locked then
190 --
191 -- The object is locked therefore we need to supply a meaningful
192 -- error message.
193 --
194 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
195 hr_utility.set_message_token('TABLE_NAME', 'ben_csr_activities');
196 hr_utility.raise_error;
197 End lck;
198 --
199 -- ----------------------------------------------------------------------------
200 -- |-----------------------------< convert_args >-----------------------------|
201 -- ----------------------------------------------------------------------------
202 Function convert_args
203 (
204 p_csr_activities_id in number,
205 p_ordr_num in number,
206 p_function_name in varchar2,
207 p_user_function_name in varchar2,
208 p_function_type in varchar2,
209 p_business_group_id in number,
210 p_object_version_number in number,
211 p_start_date in date,
212 p_end_date in date
213 )
214 Return g_rec_type is
215 --
216 l_rec g_rec_type;
217 l_proc varchar2(72) := g_package||'convert_args';
218 --
219 Begin
220 --
221 hr_utility.set_location('Entering:'||l_proc, 5);
222 --
223 -- Convert arguments into local l_rec structure.
224 --
225 l_rec.csr_activities_id := p_csr_activities_id;
226 l_rec.ordr_num := p_ordr_num;
227 l_rec.function_name := p_function_name;
228 l_rec.user_function_name := p_user_function_name;
229 l_rec.function_type := p_function_type;
230 l_rec.business_group_id := p_business_group_id;
231 l_rec.object_version_number := p_object_version_number;
232 l_rec.start_date := p_start_date;
233 l_rec.end_date := p_end_date;
234 --
235 -- Return the plsql record structure.
236 --
237 hr_utility.set_location(' Leaving:'||l_proc, 10);
238 Return(l_rec);
239 --
242 end ben_ola_shd;
240 End convert_args;
241 --