DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_LPC_SHD

Source


1 Package Body ota_lpc_shd as
2 /* $Header: otlpcrhi.pkb 120.0 2005/05/29 07:20:52 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ota_lpc_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc        varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If (p_constraint_name = 'OTA_LP_SECTIONS_PK') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   Else
27     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30     fnd_message.raise_error;
31   End If;
32   --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39   (p_learning_path_section_id             in     number
40   ,p_object_version_number                in     number
41   )
42   Return Boolean Is
43   --
44   --
45   -- Cursor selects the 'current' row from the HR Schema
46   --
47   Cursor C_Sel1 is
48     select
49        learning_path_section_id
50       ,learning_path_id
51       ,section_sequence
52       ,completion_type_code
53       ,no_of_mandatory_courses
54       ,business_group_id
55       ,object_version_number
56       ,attribute_category
57       ,attribute1
58       ,attribute2
59       ,attribute3
60       ,attribute4
61       ,attribute5
62       ,attribute6
63       ,attribute7
64       ,attribute8
65       ,attribute9
66       ,attribute10
67       ,attribute11
68       ,attribute12
69       ,attribute13
70       ,attribute14
71       ,attribute15
72       ,attribute16
73       ,attribute17
74       ,attribute18
75       ,attribute19
76       ,attribute20
77     from        ota_lp_sections
78     where       learning_path_section_id = p_learning_path_section_id;
79   --
80   l_fct_ret     boolean;
81   --
82 Begin
83   --
84   If (p_learning_path_section_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 (p_learning_path_section_id
94         = ota_lpc_shd.g_old_rec.learning_path_section_id and
95         p_object_version_number
96         = ota_lpc_shd.g_old_rec.object_version_number
97        ) Then
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 ota_lpc_shd.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         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
115         fnd_message.raise_error;
116       End If;
117       Close C_Sel1;
118       If (p_object_version_number
119           <> ota_lpc_shd.g_old_rec.object_version_number) Then
120         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
121         fnd_message.raise_error;
122       End If;
123       l_fct_ret := true;
124     End If;
125   End If;
126   Return (l_fct_ret);
127 --
128 End api_updating;
129 --
130 -- ----------------------------------------------------------------------------
131 -- |---------------------------------< lck >----------------------------------|
132 -- ----------------------------------------------------------------------------
133 Procedure lck
134   (p_learning_path_section_id             in     number
135   ,p_object_version_number                in     number
136   ) is
137 --
138 -- Cursor selects the 'current' row from the HR Schema
139 --
140   Cursor C_Sel1 is
141     select
142        learning_path_section_id
143       ,learning_path_id
144       ,section_sequence
145       ,completion_type_code
146       ,no_of_mandatory_courses
147       ,business_group_id
148       ,object_version_number
149       ,attribute_category
150       ,attribute1
151       ,attribute2
152       ,attribute3
153       ,attribute4
154       ,attribute5
155       ,attribute6
156       ,attribute7
157       ,attribute8
158       ,attribute9
159       ,attribute10
160       ,attribute11
161       ,attribute12
162       ,attribute13
163       ,attribute14
164       ,attribute15
165       ,attribute16
166       ,attribute17
167       ,attribute18
168       ,attribute19
169       ,attribute20
170     from        ota_lp_sections
171     where       learning_path_section_id = p_learning_path_section_id
172     for update nowait;
173 --
174   l_proc        varchar2(72) := g_package||'lck';
175 --
176 Begin
177   hr_utility.set_location('Entering:'||l_proc, 5);
178   --
179   hr_api.mandatory_arg_error
180     (p_api_name           => l_proc
181     ,p_argument           => 'LEARNING_PATH_SECTION_ID'
182     ,p_argument_value     => p_learning_path_section_id
183     );
184   hr_utility.set_location(l_proc,6);
185   hr_api.mandatory_arg_error
186     (p_api_name           => l_proc
187     ,p_argument           => 'OBJECT_VERSION_NUMBER'
188     ,p_argument_value     => p_object_version_number
189     );
190   --
191   Open  C_Sel1;
192   Fetch C_Sel1 Into ota_lpc_shd.g_old_rec;
193   If C_Sel1%notfound then
194     Close C_Sel1;
195     --
196     -- The primary key is invalid therefore we must error
197     --
198     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
199     fnd_message.raise_error;
200   End If;
201   Close C_Sel1;
202   If (p_object_version_number
203       <> ota_lpc_shd.g_old_rec.object_version_number) Then
204         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
205         fnd_message.raise_error;
206   End If;
207   --
208   hr_utility.set_location(' Leaving:'||l_proc, 10);
209   --
210   -- We need to trap the ORA LOCK exception
211   --
212 Exception
213   When HR_Api.Object_Locked then
214     --
215     -- The object is locked therefore we need to supply a meaningful
216     -- error message.
217     --
218     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
219     fnd_message.set_token('TABLE_NAME', 'ota_lp_sections');
220     fnd_message.raise_error;
221 End lck;
222 --
223 -- ----------------------------------------------------------------------------
224 -- |-----------------------------< convert_args >-----------------------------|
225 -- ----------------------------------------------------------------------------
226 Function convert_args
227   (p_learning_path_section_id       in number
228   ,p_learning_path_id               in number
229   ,p_section_sequence               in number
230   ,p_completion_type_code           in varchar2
231   ,p_no_of_mandatory_courses        in number
232   ,p_business_group_id              in number
233   ,p_object_version_number          in number
234   ,p_attribute_category             in varchar2
235   ,p_attribute1                     in varchar2
236   ,p_attribute2                     in varchar2
237   ,p_attribute3                     in varchar2
238   ,p_attribute4                     in varchar2
239   ,p_attribute5                     in varchar2
240   ,p_attribute6                     in varchar2
241   ,p_attribute7                     in varchar2
242   ,p_attribute8                     in varchar2
243   ,p_attribute9                     in varchar2
244   ,p_attribute10                    in varchar2
245   ,p_attribute11                    in varchar2
246   ,p_attribute12                    in varchar2
247   ,p_attribute13                    in varchar2
248   ,p_attribute14                    in varchar2
249   ,p_attribute15                    in varchar2
250   ,p_attribute16                    in varchar2
251   ,p_attribute17                    in varchar2
252   ,p_attribute18                    in varchar2
253   ,p_attribute19                    in varchar2
254   ,p_attribute20                    in varchar2
255   )
256   Return g_rec_type is
257 --
258   l_rec   g_rec_type;
259 --
260 Begin
261   --
262   -- Convert arguments into local l_rec structure.
263   --
264   l_rec.learning_path_section_id         := p_learning_path_section_id;
265   l_rec.learning_path_id                 := p_learning_path_id;
266   l_rec.section_sequence                 := p_section_sequence;
267   l_rec.completion_type_code             := p_completion_type_code;
268   l_rec.no_of_mandatory_courses          := p_no_of_mandatory_courses;
269   l_rec.business_group_id                := p_business_group_id;
270   l_rec.object_version_number            := p_object_version_number;
271   l_rec.attribute_category               := p_attribute_category;
272   l_rec.attribute1                       := p_attribute1;
273   l_rec.attribute2                       := p_attribute2;
274   l_rec.attribute3                       := p_attribute3;
275   l_rec.attribute4                       := p_attribute4;
276   l_rec.attribute5                       := p_attribute5;
277   l_rec.attribute6                       := p_attribute6;
278   l_rec.attribute7                       := p_attribute7;
279   l_rec.attribute8                       := p_attribute8;
280   l_rec.attribute9                       := p_attribute9;
281   l_rec.attribute10                      := p_attribute10;
282   l_rec.attribute11                      := p_attribute11;
283   l_rec.attribute12                      := p_attribute12;
284   l_rec.attribute13                      := p_attribute13;
285   l_rec.attribute14                      := p_attribute14;
286   l_rec.attribute15                      := p_attribute15;
287   l_rec.attribute16                      := p_attribute16;
288   l_rec.attribute17                      := p_attribute17;
289   l_rec.attribute18                      := p_attribute18;
290   l_rec.attribute19                      := p_attribute19;
291   l_rec.attribute20                      := p_attribute20;
292   --
293   -- Return the plsql record structure.
294   --
295   Return(l_rec);
296 --
297 End convert_args;
298 --
299 end ota_lpc_shd;