DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_DRR_SHD

Source


1 Package Body ben_drr_shd as
2 /* $Header: bedrrrhi.pkb 120.0 2005/05/28 01:40:22 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_drr_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_DSGN_RQMT_RLSHP_TYP_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_dsgn_rqmt_rlshp_typ_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 		dsgn_rqmt_rlshp_typ_id,
66 	rlshp_typ_cd,
67 	dsgn_rqmt_id,
68 	business_group_id,
69 	drr_attribute_category,
70 	drr_attribute1,
71 	drr_attribute2,
72 	drr_attribute3,
73 	drr_attribute4,
74 	drr_attribute5,
75 	drr_attribute6,
76 	drr_attribute7,
77 	drr_attribute8,
78 	drr_attribute9,
79 	drr_attribute10,
80 	drr_attribute11,
81 	drr_attribute12,
82 	drr_attribute13,
83 	drr_attribute14,
84 	drr_attribute15,
85 	drr_attribute16,
86 	drr_attribute17,
87 	drr_attribute18,
88 	drr_attribute19,
89 	drr_attribute20,
90 	drr_attribute21,
91 	drr_attribute22,
92 	drr_attribute23,
93 	drr_attribute24,
94 	drr_attribute25,
95 	drr_attribute26,
96 	drr_attribute27,
97 	drr_attribute28,
98 	drr_attribute29,
99 	drr_attribute30,
100 	object_version_number
101     from	ben_dsgn_rqmt_rlshp_typ
102     where	dsgn_rqmt_rlshp_typ_id = p_dsgn_rqmt_rlshp_typ_id;
103 --
104   l_proc	varchar2(72)	:= g_package||'api_updating';
105   l_fct_ret	boolean;
106 --
107 Begin
108   hr_utility.set_location('Entering:'||l_proc, 5);
109   --
110   If (
111 	p_dsgn_rqmt_rlshp_typ_id is null and
112 	p_object_version_number is null
113      ) Then
114     --
115     -- One of the primary key arguments is null therefore we must
116     -- set the returning function value to false
117     --
118     l_fct_ret := false;
119   Else
120     If (
121 	p_dsgn_rqmt_rlshp_typ_id = g_old_rec.dsgn_rqmt_rlshp_typ_id and
122 	p_object_version_number = g_old_rec.object_version_number
123        ) Then
124       hr_utility.set_location(l_proc, 10);
125       --
126       -- The g_old_rec is current therefore we must
127       -- set the returning function to true
128       --
129       l_fct_ret := true;
130     Else
131       --
132       -- Select the current row into g_old_rec
133       --
134       Open C_Sel1;
135       Fetch C_Sel1 Into g_old_rec;
136       If C_Sel1%notfound Then
137         Close C_Sel1;
138         --
139         -- The primary key is invalid therefore we must error
140         --
141         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
142         hr_utility.raise_error;
143       End If;
144       Close C_Sel1;
145       If (p_object_version_number <> g_old_rec.object_version_number) Then
146         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
147         hr_utility.raise_error;
148       End If;
149       hr_utility.set_location(l_proc, 15);
150       l_fct_ret := true;
151     End If;
152   End If;
153   hr_utility.set_location(' Leaving:'||l_proc, 20);
154   Return (l_fct_ret);
155 --
156 End api_updating;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |---------------------------------< lck >----------------------------------|
160 -- ----------------------------------------------------------------------------
161 Procedure lck
162   (
163   p_dsgn_rqmt_rlshp_typ_id             in number,
164   p_object_version_number              in number
165   ) is
166 --
167 -- Cursor selects the 'current' row from the HR Schema
168 --
169   Cursor C_Sel1 is
170     select 	dsgn_rqmt_rlshp_typ_id,
171 	rlshp_typ_cd,
172 	dsgn_rqmt_id,
173 	business_group_id,
174 	drr_attribute_category,
175 	drr_attribute1,
176 	drr_attribute2,
177 	drr_attribute3,
178 	drr_attribute4,
179 	drr_attribute5,
180 	drr_attribute6,
181 	drr_attribute7,
182 	drr_attribute8,
183 	drr_attribute9,
184 	drr_attribute10,
185 	drr_attribute11,
186 	drr_attribute12,
187 	drr_attribute13,
188 	drr_attribute14,
189 	drr_attribute15,
190 	drr_attribute16,
191 	drr_attribute17,
192 	drr_attribute18,
193 	drr_attribute19,
194 	drr_attribute20,
195 	drr_attribute21,
196 	drr_attribute22,
197 	drr_attribute23,
198 	drr_attribute24,
199 	drr_attribute25,
200 	drr_attribute26,
201 	drr_attribute27,
202 	drr_attribute28,
203 	drr_attribute29,
204 	drr_attribute30,
205 	object_version_number
206     from	ben_dsgn_rqmt_rlshp_typ
207     where	dsgn_rqmt_rlshp_typ_id = p_dsgn_rqmt_rlshp_typ_id
208     for	update nowait;
209 --
210   l_proc	varchar2(72) := g_package||'lck';
211 --
212 Begin
213   hr_utility.set_location('Entering:'||l_proc, 5);
214   --
215   -- Add any mandatory argument checking here:
216   -- Example:
217   -- hr_api.mandatory_arg_error
218   --   (p_api_name       => l_proc,
219   --    p_argument       => 'object_version_number',
220   --    p_argument_value => p_object_version_number);
221   --
222   Open  C_Sel1;
223   Fetch C_Sel1 Into g_old_rec;
224   If C_Sel1%notfound then
225     Close C_Sel1;
226     --
227     -- The primary key is invalid therefore we must error
228     --
229     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
230     hr_utility.raise_error;
231   End If;
232   Close C_Sel1;
233   If (p_object_version_number <> g_old_rec.object_version_number) Then
234         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
235         hr_utility.raise_error;
236       End If;
237 --
238   hr_utility.set_location(' Leaving:'||l_proc, 10);
239 --
240 -- We need to trap the ORA LOCK exception
241 --
242 Exception
243   When HR_Api.Object_Locked then
244     --
245     -- The object is locked therefore we need to supply a meaningful
246     -- error message.
247     --
248     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
249     hr_utility.set_message_token('TABLE_NAME', 'ben_dsgn_rqmt_rlshp_typ');
250     hr_utility.raise_error;
251 End lck;
252 --
253 -- ----------------------------------------------------------------------------
254 -- |-----------------------------< convert_args >-----------------------------|
255 -- ----------------------------------------------------------------------------
256 Function convert_args
257 	(
258 	p_dsgn_rqmt_rlshp_typ_id        in number,
259 	p_rlshp_typ_cd                  in varchar2,
260 	p_dsgn_rqmt_id                  in number,
261 	p_business_group_id             in number,
262 	p_drr_attribute_category        in varchar2,
263 	p_drr_attribute1                in varchar2,
264 	p_drr_attribute2                in varchar2,
265 	p_drr_attribute3                in varchar2,
266 	p_drr_attribute4                in varchar2,
267 	p_drr_attribute5                in varchar2,
268 	p_drr_attribute6                in varchar2,
269 	p_drr_attribute7                in varchar2,
270 	p_drr_attribute8                in varchar2,
271 	p_drr_attribute9                in varchar2,
272 	p_drr_attribute10               in varchar2,
273 	p_drr_attribute11               in varchar2,
274 	p_drr_attribute12               in varchar2,
275 	p_drr_attribute13               in varchar2,
276 	p_drr_attribute14               in varchar2,
277 	p_drr_attribute15               in varchar2,
278 	p_drr_attribute16               in varchar2,
279 	p_drr_attribute17               in varchar2,
280 	p_drr_attribute18               in varchar2,
281 	p_drr_attribute19               in varchar2,
282 	p_drr_attribute20               in varchar2,
283 	p_drr_attribute21               in varchar2,
284 	p_drr_attribute22               in varchar2,
285 	p_drr_attribute23               in varchar2,
286 	p_drr_attribute24               in varchar2,
287 	p_drr_attribute25               in varchar2,
288 	p_drr_attribute26               in varchar2,
289 	p_drr_attribute27               in varchar2,
290 	p_drr_attribute28               in varchar2,
291 	p_drr_attribute29               in varchar2,
292 	p_drr_attribute30               in varchar2,
293 	p_object_version_number         in number
294 	)
295 	Return g_rec_type is
296 --
297   l_rec	  g_rec_type;
298   l_proc  varchar2(72) := g_package||'convert_args';
299 --
300 Begin
301   --
302   hr_utility.set_location('Entering:'||l_proc, 5);
303   --
304   -- Convert arguments into local l_rec structure.
305   --
306   l_rec.dsgn_rqmt_rlshp_typ_id           := p_dsgn_rqmt_rlshp_typ_id;
307   l_rec.rlshp_typ_cd                     := p_rlshp_typ_cd;
308   l_rec.dsgn_rqmt_id                     := p_dsgn_rqmt_id;
309   l_rec.business_group_id                := p_business_group_id;
310   l_rec.drr_attribute_category           := p_drr_attribute_category;
311   l_rec.drr_attribute1                   := p_drr_attribute1;
312   l_rec.drr_attribute2                   := p_drr_attribute2;
313   l_rec.drr_attribute3                   := p_drr_attribute3;
314   l_rec.drr_attribute4                   := p_drr_attribute4;
315   l_rec.drr_attribute5                   := p_drr_attribute5;
316   l_rec.drr_attribute6                   := p_drr_attribute6;
317   l_rec.drr_attribute7                   := p_drr_attribute7;
318   l_rec.drr_attribute8                   := p_drr_attribute8;
319   l_rec.drr_attribute9                   := p_drr_attribute9;
320   l_rec.drr_attribute10                  := p_drr_attribute10;
321   l_rec.drr_attribute11                  := p_drr_attribute11;
322   l_rec.drr_attribute12                  := p_drr_attribute12;
323   l_rec.drr_attribute13                  := p_drr_attribute13;
324   l_rec.drr_attribute14                  := p_drr_attribute14;
325   l_rec.drr_attribute15                  := p_drr_attribute15;
326   l_rec.drr_attribute16                  := p_drr_attribute16;
327   l_rec.drr_attribute17                  := p_drr_attribute17;
328   l_rec.drr_attribute18                  := p_drr_attribute18;
329   l_rec.drr_attribute19                  := p_drr_attribute19;
330   l_rec.drr_attribute20                  := p_drr_attribute20;
331   l_rec.drr_attribute21                  := p_drr_attribute21;
332   l_rec.drr_attribute22                  := p_drr_attribute22;
333   l_rec.drr_attribute23                  := p_drr_attribute23;
334   l_rec.drr_attribute24                  := p_drr_attribute24;
335   l_rec.drr_attribute25                  := p_drr_attribute25;
336   l_rec.drr_attribute26                  := p_drr_attribute26;
337   l_rec.drr_attribute27                  := p_drr_attribute27;
338   l_rec.drr_attribute28                  := p_drr_attribute28;
339   l_rec.drr_attribute29                  := p_drr_attribute29;
340   l_rec.drr_attribute30                  := p_drr_attribute30;
341   l_rec.object_version_number            := p_object_version_number;
342   --
343   -- Return the plsql record structure.
344   --
345   hr_utility.set_location(' Leaving:'||l_proc, 10);
346   Return(l_rec);
347 --
348 End convert_args;
349 --
350 end ben_drr_shd;