DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_PMM_SHD

Source


4 -- ----------------------------------------------------------------------------
1 Package Body ota_pmm_shd as
2 /* $Header: otpmm01t.pkb 115.2 99/07/16 00:53:06 porting ship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ota_pmm_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 varchar2) 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 = 'OTA_PMM_REQUIRED_FLAG_CHK') Then
37     hr_utility.set_message(801, 'OTA_13423_PMM_REQUIRED_FLAG');
38     hr_utility.raise_error;
39   ElsIf (p_constraint_name = 'OTA_PROGRAM_MEMBERSHIPS_FK1') Then
40     hr_utility.set_message(801, 'OTA_13424_PMM_NO_EVENT');
41     hr_utility.raise_error;
42   ElsIf (p_constraint_name = 'OTA_PROGRAM_MEMBERSHIPS_FK2') Then
43     hr_utility.set_message(801, 'OTA_13425_PMM_NO_PROGRAM');
44     hr_utility.raise_error;
45   ElsIf (p_constraint_name = 'OTA_PROGRAM_MEMBERSHIPS_PK') Then
46     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
47     hr_utility.raise_error;
48   Else
49     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
50     hr_utility.set_message_token('PROCEDURE', l_proc);
51     hr_utility.set_message_token('STEP','25');
52     hr_utility.raise_error;
53   End If;
54   --
55   hr_utility.set_location(' Leaving:'||l_proc, 10);
56 End constraint_error;
57 --
58 -- ----------------------------------------------------------------------------
59 -- |-----------------------------< api_updating >-----------------------------|
60 -- ----------------------------------------------------------------------------
61 Function api_updating
62   (
63   p_program_membership_id              in number,
64   p_object_version_number              in number
65   )      Return Boolean Is
66 --
67   --
68   -- Cursor selects the 'current' row from the HR Schema
69   --
70   Cursor C_Sel1 is
71     select
72 		program_membership_id,
73 	event_id,
74 	program_event_id,
75 	object_version_number,
76 	comments,
77 	group_name,
78 	required_flag,
79 	role,
80 	sequence,
81 	pmm_information_category,
82 	pmm_information1,
83 	pmm_information2,
84 	pmm_information3,
85 	pmm_information4,
86 	pmm_information5,
87 	pmm_information6,
88 	pmm_information7,
92 	pmm_information11,
89 	pmm_information8,
90 	pmm_information9,
91 	pmm_information10,
93 	pmm_information12,
94 	pmm_information13,
95 	pmm_information14,
96 	pmm_information15,
97 	pmm_information16,
98 	pmm_information17,
99 	pmm_information18,
100 	pmm_information19,
101 	pmm_information20
102     from	ota_program_memberships
103     where	program_membership_id = p_program_membership_id;
104 --
105   l_proc	varchar2(72)	:= g_package||'api_updating';
106   l_fct_ret	boolean;
107 --
108 Begin
109   hr_utility.set_location('Entering:'||l_proc, 5);
110   --
111   If (
112 	p_program_membership_id is null and
113 	p_object_version_number is null
114      ) Then
115     --
116     -- One of the primary key arguments is null therefore we must
117     -- set the returning function value to false
118     --
119     l_fct_ret := false;
120   Else
121     If (
122 	p_program_membership_id = g_old_rec.program_membership_id and
123 	p_object_version_number = g_old_rec.object_version_number
124        ) Then
125       hr_utility.set_location(l_proc, 10);
126       --
127       -- The g_old_rec is current therefore we must
128       -- set the returning function to true
129       --
130       l_fct_ret := true;
131     Else
132       --
133       -- Select the current row into g_old_rec
134       --
135       Open C_Sel1;
136       Fetch C_Sel1 Into g_old_rec;
137       If C_Sel1%notfound Then
138         Close C_Sel1;
139         --
140         -- The primary key is invalid therefore we must error
141         --
142         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
143         hr_utility.raise_error;
144       End If;
145       Close C_Sel1;
146       If (p_object_version_number <> g_old_rec.object_version_number) Then
147         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
148         hr_utility.raise_error;
149       End If;
150       hr_utility.set_location(l_proc, 15);
151       l_fct_ret := true;
152     End If;
153   End If;
154   hr_utility.set_location(' Leaving:'||l_proc, 20);
155   Return (l_fct_ret);
156 --
157 End api_updating;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |---------------------------------< lck >----------------------------------|
161 -- ----------------------------------------------------------------------------
162 Procedure lck
163   (
164   p_program_membership_id              in number,
165   p_object_version_number              in number
166   ) is
167 --
168 -- Cursor selects the 'current' row from the HR Schema
169 --
170   Cursor C_Sel1 is
171     select 	program_membership_id,
172 	event_id,
173 	program_event_id,
174 	object_version_number,
175 	comments,
176 	group_name,
177 	required_flag,
178 	role,
179 	sequence,
180 	pmm_information_category,
181 	pmm_information1,
182 	pmm_information2,
183 	pmm_information3,
184 	pmm_information4,
185 	pmm_information5,
186 	pmm_information6,
187 	pmm_information7,
188 	pmm_information8,
192 	pmm_information12,
189 	pmm_information9,
190 	pmm_information10,
191 	pmm_information11,
193 	pmm_information13,
194 	pmm_information14,
195 	pmm_information15,
196 	pmm_information16,
197 	pmm_information17,
198 	pmm_information18,
199 	pmm_information19,
200 	pmm_information20
201     from	ota_program_memberships
202     where	program_membership_id = p_program_membership_id
203     for	update nowait;
204 --
205   l_proc	varchar2(72) := g_package||'lck';
206 --
207 Begin
208   hr_utility.set_location('Entering:'||l_proc, 5);
209   --
210   -- Add any mandatory argument checking here:
211   -- Example:
212   -- hr_api.mandatory_arg_error
213   --   (p_api_name       => l_proc,
214   --    p_argument       => 'object_version_number',
215   --    p_argument_value => p_object_version_number);
216   --
217   Open  C_Sel1;
218   Fetch C_Sel1 Into g_old_rec;
219   If C_Sel1%notfound then
220     Close C_Sel1;
221     --
222     -- The primary key is invalid therefore we must error
223     --
224     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
225     hr_utility.raise_error;
226   End If;
227   Close C_Sel1;
228   If (p_object_version_number <> g_old_rec.object_version_number) Then
229         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
230         hr_utility.raise_error;
231       End If;
232 --
233   hr_utility.set_location(' Leaving:'||l_proc, 10);
234 --
235 -- We need to trap the ORA LOCK exception
236 --
237 Exception
238   When HR_Api.Object_Locked then
239     --
240     -- The object is locked therefore we need to supply a meaningful
241     -- error message.
242     --
243     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
244     hr_utility.set_message_token('TABLE_NAME', 'ota_program_memberships');
245     hr_utility.raise_error;
246 End lck;
247 --
248 -- ----------------------------------------------------------------------------
249 -- |-----------------------------< convert_args >-----------------------------|
250 -- ----------------------------------------------------------------------------
251 Function convert_args
252 	(
253 	p_program_membership_id         in number,
254 	p_event_id                      in number,
255 	p_program_event_id              in number,
256 	p_object_version_number         in number,
257 	p_comments                      in varchar2,
258 	p_group_name                    in varchar2,
259 	p_required_flag                 in varchar2,
260 	p_role                          in varchar2,
261 	p_sequence                      in number,
262 	p_pmm_information_category      in varchar2,
263 	p_pmm_information1              in varchar2,
264 	p_pmm_information2              in varchar2,
265 	p_pmm_information3              in varchar2,
266 	p_pmm_information4              in varchar2,
267 	p_pmm_information5              in varchar2,
268 	p_pmm_information6              in varchar2,
269 	p_pmm_information7              in varchar2,
270 	p_pmm_information8              in varchar2,
271 	p_pmm_information9              in varchar2,
272 	p_pmm_information10             in varchar2,
273 	p_pmm_information11             in varchar2,
274 	p_pmm_information12             in varchar2,
275 	p_pmm_information13             in varchar2,
276 	p_pmm_information14             in varchar2,
277 	p_pmm_information15             in varchar2,
278 	p_pmm_information16             in varchar2,
279 	p_pmm_information17             in varchar2,
280 	p_pmm_information18             in varchar2,
281 	p_pmm_information19             in varchar2,
282 	p_pmm_information20             in varchar2
283 	)
284 	Return g_rec_type is
285 --
286   l_rec	  g_rec_type;
287   l_proc  varchar2(72) := g_package||'convert_args';
288 --
289 Begin
290   --
291   hr_utility.set_location('Entering:'||l_proc, 5);
292   --
293   -- Convert arguments into local l_rec structure.
294   --
295   l_rec.program_membership_id            := p_program_membership_id;
296   l_rec.event_id                         := p_event_id;
297   l_rec.program_event_id                 := p_program_event_id;
298   l_rec.object_version_number            := p_object_version_number;
299   l_rec.comments                         := p_comments;
303   l_rec.sequence                         := p_sequence;
300   l_rec.group_name                       := p_group_name;
301   l_rec.required_flag                    := p_required_flag;
302   l_rec.role                             := p_role;
304   l_rec.pmm_information_category         := p_pmm_information_category;
305   l_rec.pmm_information1                 := p_pmm_information1;
306   l_rec.pmm_information2                 := p_pmm_information2;
307   l_rec.pmm_information3                 := p_pmm_information3;
308   l_rec.pmm_information4                 := p_pmm_information4;
309   l_rec.pmm_information5                 := p_pmm_information5;
310   l_rec.pmm_information6                 := p_pmm_information6;
311   l_rec.pmm_information7                 := p_pmm_information7;
312   l_rec.pmm_information8                 := p_pmm_information8;
313   l_rec.pmm_information9                 := p_pmm_information9;
314   l_rec.pmm_information10                := p_pmm_information10;
315   l_rec.pmm_information11                := p_pmm_information11;
316   l_rec.pmm_information12                := p_pmm_information12;
317   l_rec.pmm_information13                := p_pmm_information13;
318   l_rec.pmm_information14                := p_pmm_information14;
319   l_rec.pmm_information15                := p_pmm_information15;
320   l_rec.pmm_information16                := p_pmm_information16;
321   l_rec.pmm_information17                := p_pmm_information17;
322   l_rec.pmm_information18                := p_pmm_information18;
323   l_rec.pmm_information19                := p_pmm_information19;
324   l_rec.pmm_information20                := p_pmm_information20;
325   --
326   -- Return the plsql record structure.
327   --
328   hr_utility.set_location(' Leaving:'||l_proc, 10);
329   Return(l_rec);
330 --
331 End convert_args;
332 --
333 end ota_pmm_shd;