DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_PDC_SHD

Source


1 Package Body ghr_pdc_shd as
2 /* $Header: ghpdcrhi.pkb 115.6 1999/11/09 22:43:48 pkm ship    $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ghr_pdc_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 /*
14 Function return_api_dml_status Return Boolean Is
15 --
16   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
17 --
18 Begin
19   hr_utility.set_location('Entering:'||l_proc, 5);
20   --
21   Return (nvl(g_api_dml, false));
22   --
23   hr_utility.set_location(' Leaving:'||l_proc, 10);
24 End return_api_dml_status;
25 */
26 
27 --
28 -- ----------------------------------------------------------------------------
29 -- |---------------------------< constraint_error >---------------------------|
30 -- ----------------------------------------------------------------------------
31 Procedure constraint_error
32             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
33 --
34   l_proc 	varchar2(72) := g_package||'constraint_error';
35 --
36 Begin
37   hr_utility.set_location('Entering:'||l_proc, 5);
38   --
39   If (p_constraint_name = 'GHR_PD_CLASSIFICATIONS_FK1') Then
40     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
41     hr_utility.set_message_token('PROCEDURE', l_proc);
42     hr_utility.set_message_token('STEP','5');
43     hr_utility.raise_error;
44   ElsIf (p_constraint_name = 'GHR_PD_CLASSIFICATIONS_FK2') Then
45     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
46     hr_utility.set_message_token('PROCEDURE', l_proc);
47     hr_utility.set_message_token('STEP','5');
48     hr_utility.raise_error;
49   ElsIf (p_constraint_name = 'GHR_PD_CLASSIFICATIONS_PK') Then
50     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
51     hr_utility.set_message_token('PROCEDURE', l_proc);
52     hr_utility.set_message_token('STEP','10');
53     hr_utility.raise_error;
54   ElsIf (p_constraint_name = 'PD_CLASSIFICATIONS_UK') Then
55     hr_utility.set_message(8301, 'GHR_MULTIPLE_FEEDBACKS');
56     hr_utility.set_message_token('PROCEDURE', l_proc);
57     hr_utility.set_message_token('STEP','15');
58     hr_utility.raise_error;
59   Else
60     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
61     hr_utility.set_message_token('PROCEDURE', l_proc);
62     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
63     hr_utility.raise_error;
64   End If;
65   --
66   hr_utility.set_location(' Leaving:'||l_proc, 10);
67 End constraint_error;
68 --
69 -- ----------------------------------------------------------------------------
70 -- |-----------------------------< api_updating >-----------------------------|
71 -- ----------------------------------------------------------------------------
72 Function api_updating
73   (
74   p_pd_classification_id               in number,
75   p_object_version_number              in number
76   )      Return Boolean Is
77 --
78   --
79   -- Cursor selects the 'current' row from the HR Schema
80   --
81   Cursor C_Sel1 is
82     select
83 		pd_classification_id,
84 	position_description_id,
85 	class_grade_by,
86 	official_title,
87 	pay_plan,
88 	occupational_code,
89 	grade_level,
90 	object_version_number
91     from	ghr_pd_classifications
92     where	pd_classification_id = p_pd_classification_id;
93 --
94   l_proc	varchar2(72)	:= g_package||'api_updating';
95   l_fct_ret	boolean;
96 --
97 Begin
98   hr_utility.set_location('Entering:'||l_proc, 5);
99   --
100   If (
101 	p_pd_classification_id is null and
102 	p_object_version_number is null
103      ) Then
104     --
105     -- One of the primary key arguments is null therefore we must
106     -- set the returning function value to false
107     --
108     l_fct_ret := false;
109   Else
110     If (
111 	p_pd_classification_id = g_old_rec.pd_classification_id and
112 	p_object_version_number = g_old_rec.object_version_number
113        ) Then
114       hr_utility.set_location(l_proc, 10);
115       --
116       -- The g_old_rec is current therefore we must
117       -- set the returning function to true
118       --
119       l_fct_ret := true;
120     Else
121       --
122       -- Select the current row into g_old_rec
123       --
124       Open C_Sel1;
125       Fetch C_Sel1 Into g_old_rec;
126       If C_Sel1%notfound Then
127         Close C_Sel1;
128         --
129         -- The primary key is invalid therefore we must error
130         --
131         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
132         hr_utility.raise_error;
133       End If;
134       Close C_Sel1;
135       If (p_object_version_number <> g_old_rec.object_version_number) Then
136         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
137         hr_utility.raise_error;
138       End If;
139       hr_utility.set_location(l_proc, 15);
140       l_fct_ret := true;
141     End If;
142   End If;
143   hr_utility.set_location(' Leaving:'||l_proc, 20);
144   Return (l_fct_ret);
145 --
146 End api_updating;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |---------------------------------< lck >----------------------------------|
150 -- ----------------------------------------------------------------------------
151 Procedure lck
152   (
153   p_pd_classification_id               in number,
154   p_object_version_number              in number
155   ) is
156 --
157 -- Cursor selects the 'current' row from the HR Schema
158 --
159   Cursor C_Sel1 is
160     select 	pd_classification_id,
161 	position_description_id,
162 	class_grade_by,
163 	official_title,
164 	pay_plan,
165 	occupational_code,
166 	grade_level,
167 	object_version_number
168     from	ghr_pd_classifications
169     where	pd_classification_id = p_pd_classification_id
170     for	update nowait;
171 --
172   l_proc	varchar2(72) := g_package||'lck';
173 --
174 Begin
175 
176   hr_utility.set_location('Entering:'||l_proc, 5);
177   --
178   -- Add any mandatory argument checking here:
179   -- Example:
180   -- hr_api.mandatory_arg_error
181   --   (p_api_name       => l_proc,
182   --    p_argument       => 'object_version_number',
183   --    p_argument_value => p_object_version_number);
184   --
185   Open  C_Sel1;
186   Fetch C_Sel1 Into g_old_rec;
187   If C_Sel1%notfound then
188     Close C_Sel1;
189     --
190     -- The primary key is invalid therefore we must error
191     --
192     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
193     hr_utility.raise_error;
194   End If;
195   Close C_Sel1;
196   If (p_object_version_number <> g_old_rec.object_version_number) Then
197         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
198         hr_utility.raise_error;
199       End If;
200 --
201   hr_utility.set_location(' Leaving:'||l_proc, 10);
202 --
203 -- We need to trap the ORA LOCK exception
204 --
205 Exception
206   When HR_Api.Object_Locked then
207     --
208     -- The object is locked therefore we need to supply a meaningful
209     -- error message.
210     --
211     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
212     hr_utility.set_message_token('TABLE_NAME', 'ghr_pd_classifications');
213     hr_utility.raise_error;
214 End lck;
215 --
216 -- ----------------------------------------------------------------------------
217 -- |-----------------------------< convert_args >-----------------------------|
218 -- ----------------------------------------------------------------------------
219 Function convert_args
220 	(
221 	p_pd_classification_id          in number,
222 	p_position_description_id       in number,
223 	p_class_grade_by                in varchar2,
224 	p_official_title                in varchar2,
225 	p_pay_plan                      in varchar2,
226 	p_occupational_code             in varchar2,
227 	p_grade_level                   in varchar2,
228 	p_object_version_number         in number
229 	)
230 	Return g_rec_type is
231 --
232   l_rec	  g_rec_type;
233   l_proc  varchar2(72) := g_package||'convert_args';
234 --
235 Begin
236   --
237   hr_utility.set_location('Entering:'||l_proc, 5);
238   --
239   -- Convert arguments into local l_rec structure.
240   --
241   l_rec.pd_classification_id             := p_pd_classification_id;
242   l_rec.position_description_id          := p_position_description_id;
243   l_rec.class_grade_by                   := p_class_grade_by;
244   l_rec.official_title                   := p_official_title;
245   l_rec.pay_plan                         := p_pay_plan;
246   l_rec.occupational_code                := p_occupational_code;
247   l_rec.grade_level                      := p_grade_level;
248   l_rec.object_version_number            := p_object_version_number;
249   --
250   -- Return the plsql record structure.
251   --
252   hr_utility.set_location(' Leaving:'||l_proc, 10);
253   Return(l_rec);
254 --
255 End convert_args;
256 --
257 end ghr_pdc_shd;