DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PAE_SHD

Source


1 Package Body hr_pae_shd as
2 /* $Header: hrpaerhi.pkb 115.1 99/07/17 05:36:26 porting ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_pae_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 = 'HR_PAE_PAT_FK') Then
37     --  *** NEW_MESSAGE_REQUIRED ***
38     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
39     hr_utility.set_message_token('PROCEDURE', l_proc);
40     hr_utility.set_message_token('STEP','5');
41     hr_utility.raise_error;
42   ElsIf (p_constraint_name = 'HR_PAE_PK') Then
43     --  *** NEW_MESSAGE_REQUIRED ***
44     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
45     hr_utility.set_message_token('PROCEDURE', l_proc);
46     hr_utility.set_message_token('STEP','10');
47     hr_utility.raise_error;
48   ElsIf (p_constraint_name = 'HR_PAE_START_END_TIMES') Then
49     --  *** NEW_MESSAGE_REQUIRED ***
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','15');
53     hr_utility.raise_error;
54   ElsIf (p_constraint_name = 'HR_PAE_UK01') Then
55     --  *** NEW_MESSAGE_REQUIRED ***
56     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
57     hr_utility.set_message_token('PROCEDURE', l_proc);
58     hr_utility.set_message_token('STEP','20');
59     hr_utility.raise_error;
60   Else
61     --  *** NEW_MESSAGE_REQUIRED ***
62     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
63     hr_utility.set_message_token('PROCEDURE', l_proc);
64     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
65     hr_utility.raise_error;
66   End If;
67   --
68   hr_utility.set_location(' Leaving:'||l_proc, 10);
69 End constraint_error;
70 --
71 -- ----------------------------------------------------------------------------
72 -- |-----------------------------< api_updating >-----------------------------|
73 -- ----------------------------------------------------------------------------
74 Function api_updating
75   (
76   p_exception_id                       in number,
77   p_object_version_number              in number
78   )      Return Boolean Is
79 --
80   --
81   -- Cursor selects the 'current' row from the HR Schema
82   --
83   Cursor C_Sel1 is
84     select
85 		exception_id,
86 	pattern_id,
87 	exception_name,
88 	exception_start_time,
89 	exception_end_time,
90 	exception_category,
91 	object_version_number
92     from	hr_pattern_exceptions
93     where	exception_id = p_exception_id;
94 --
95   l_proc	varchar2(72)	:= g_package||'api_updating';
96   l_fct_ret	boolean;
97 --
98 Begin
99   hr_utility.set_location('Entering:'||l_proc, 5);
100   --
101   If (
102 	p_exception_id is null and
103 	p_object_version_number is null
104      ) Then
105     --
106     -- One of the primary key arguments is null therefore we must
107     -- set the returning function value to false
108     --
109     l_fct_ret := false;
110   Else
111     If (
112 	p_exception_id = g_old_rec.exception_id and
113 	p_object_version_number = g_old_rec.object_version_number
114        ) Then
115       hr_utility.set_location(l_proc, 10);
116       --
117       -- The g_old_rec is current therefore we must
118       -- set the returning function to true
119       --
120       l_fct_ret := true;
121     Else
122       --
123       -- Select the current row into g_old_rec
124       --
125       Open C_Sel1;
126       Fetch C_Sel1 Into g_old_rec;
127       If C_Sel1%notfound Then
128         Close C_Sel1;
129         --
130         -- The primary key is invalid therefore we must error
131         --
132 	--  *** NEW_MESSAGE_REQUIRED ***
133         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
134         hr_utility.raise_error;
135       End If;
136       Close C_Sel1;
137       If (p_object_version_number <> g_old_rec.object_version_number) Then
138 	--  *** NEW_MESSAGE_REQUIRED ***
139         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
140         hr_utility.raise_error;
141       End If;
142       hr_utility.set_location(l_proc, 15);
143       l_fct_ret := true;
144     End If;
145   End If;
146   hr_utility.set_location(' Leaving:'||l_proc, 20);
147   Return (l_fct_ret);
148 --
149 End api_updating;
150 --
151 -- ----------------------------------------------------------------------------
152 -- |---------------------------------< lck >----------------------------------|
153 -- ----------------------------------------------------------------------------
154 Procedure lck
155   (
156   p_exception_id                       in number,
157   p_object_version_number              in number
158   ) is
159 --
160 -- Cursor selects the 'current' row from the HR Schema
161 --
162   Cursor C_Sel1 is
163     select 	exception_id,
164 	pattern_id,
165 	exception_name,
166 	exception_start_time,
167 	exception_end_time,
168 	exception_category,
169 	object_version_number
170     from	hr_pattern_exceptions
171     where	exception_id = p_exception_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   -- Add any mandatory argument checking here:
180   -- Example:
181   -- hr_api.mandatory_arg_error
182   --   (p_api_name       => l_proc,
183   --    p_argument       => 'object_version_number',
184   --    p_argument_value => p_object_version_number);
185   --
186   Open  C_Sel1;
187   Fetch C_Sel1 Into g_old_rec;
188   If C_Sel1%notfound then
189     Close C_Sel1;
190     --
191     -- The primary key is invalid therefore we must error
192     --
193     --  *** NEW_MESSAGE_REQUIRED ***
194     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
195     hr_utility.raise_error;
196   End If;
197   Close C_Sel1;
198   If (p_object_version_number <> g_old_rec.object_version_number) Then
199 	--  *** NEW_MESSAGE_REQUIRED ***
200         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
201         hr_utility.raise_error;
202       End If;
203 --
204   hr_utility.set_location(' Leaving:'||l_proc, 10);
205 --
206 -- We need to trap the ORA LOCK exception
207 --
208 Exception
209   When HR_Api.Object_Locked then
210     --
211     -- The object is locked therefore we need to supply a meaningful
212     -- error message.
213     --
214     --  *** NEW_MESSAGE_REQUIRED ***
215     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
216     hr_utility.set_message_token('TABLE_NAME', 'hr_pattern_exceptions');
217     hr_utility.raise_error;
218 End lck;
219 --
220 -- ----------------------------------------------------------------------------
221 -- |-----------------------------< convert_args >-----------------------------|
222 -- ----------------------------------------------------------------------------
223 Function convert_args
224 	(
225 	p_exception_id                  in number,
226 	p_pattern_id                    in number,
227 	p_exception_name                in varchar2,
228 	p_exception_start_time          in date,
229 	p_exception_end_time            in date,
230 	p_exception_category            in varchar2,
231 	p_object_version_number         in number
232 	)
233 	Return g_rec_type is
234 --
235   l_rec	  g_rec_type;
236   l_proc  varchar2(72) := g_package||'convert_args';
237 --
238 Begin
239   --
240   hr_utility.set_location('Entering:'||l_proc, 5);
241   --
242   -- Convert arguments into local l_rec structure.
243   --
244   l_rec.exception_id                     := p_exception_id;
245   l_rec.pattern_id                       := p_pattern_id;
246   l_rec.exception_name                   := p_exception_name;
247   l_rec.exception_start_time             := p_exception_start_time;
248   l_rec.exception_end_time               := p_exception_end_time;
249   l_rec.exception_category               := p_exception_category;
250   l_rec.object_version_number            := p_object_version_number;
251   --
252   -- Return the plsql record structure.
253   --
254   hr_utility.set_location(' Leaving:'||l_proc, 10);
255   Return(l_rec);
256 --
257 End convert_args;
258 --
259 end hr_pae_shd;