DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PWO_SHD

Source


1 Package Body pay_pwo_shd as
2 /* $Header: pypworhi.pkb 115.3 2002/12/05 15:11:25 swinton noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_pwo_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   --
37   --
38   hr_utility.set_location(' Leaving:'||l_proc, 10);
39 End constraint_error;
40 --
41 -- ----------------------------------------------------------------------------
42 -- |-----------------------------< api_updating >-----------------------------|
43 -- ----------------------------------------------------------------------------
44 Function api_updating
45   (
46   p_occupation_id                      in number,
47   p_object_version_number              in number
48   )      Return Boolean Is
49 --
50   --
51   -- Cursor selects the 'current' row from the HR Schema
52   --
53   Cursor C_Sel1 is
54     select
55 		occupation_id,
56 	business_group_id,
57 	rate_id,
58 	job_id,
59 	comments,
60 	object_version_number
61     from	pay_wci_occupations
62     where	occupation_id = p_occupation_id;
63 --
64   l_proc	varchar2(72)	:= g_package||'api_updating';
65   l_fct_ret	boolean;
66 --
67 Begin
68   hr_utility.set_location('Entering:'||l_proc, 5);
69   --
70   If (
71 	p_occupation_id is null and
72 	p_object_version_number is null
73      ) Then
74     --
75     -- One of the primary key arguments is null therefore we must
76     -- set the returning function value to false
77     --
78     l_fct_ret := false;
79   Else
80     If (
81 	p_occupation_id = g_old_rec.occupation_id and
82 	p_object_version_number = g_old_rec.object_version_number
83        ) Then
84       hr_utility.set_location(l_proc, 10);
85       --
86       -- The g_old_rec is current therefore we must
87       -- set the returning function to true
88       --
89       l_fct_ret := true;
90     Else
91       --
92       -- Select the current row into g_old_rec
93       --
94       Open C_Sel1;
95       Fetch C_Sel1 Into g_old_rec;
96       If C_Sel1%notfound Then
97         Close C_Sel1;
98         --
99         -- The primary key is invalid therefore we must error
100         --
101         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
102         hr_utility.raise_error;
103       End If;
104       Close C_Sel1;
105       If (p_object_version_number <> g_old_rec.object_version_number) Then
106         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
107         hr_utility.raise_error;
108       End If;
109       hr_utility.set_location(l_proc, 15);
110       l_fct_ret := true;
111     End If;
112   End If;
113   hr_utility.set_location(' Leaving:'||l_proc, 20);
114   Return (l_fct_ret);
115 --
116 End api_updating;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |---------------------------------< lck >----------------------------------|
120 -- ----------------------------------------------------------------------------
121 Procedure lck
122   (
123   p_occupation_id                      in number,
124   p_object_version_number              in number
125   ) is
126 --
127 -- Cursor selects the 'current' row from the HR Schema
128 --
129   Cursor C_Sel1 is
130     select 	occupation_id,
131 	business_group_id,
132 	rate_id,
133 	job_id,
134 	comments,
135 	object_version_number
136     from	pay_wci_occupations
137     where	occupation_id = p_occupation_id
138     for	update nowait;
139 --
140   l_proc	varchar2(72) := g_package||'lck';
141 --
142 Begin
143   hr_utility.set_location('Entering:'||l_proc, 5);
144   --
145   -- Add any mandatory argument checking here:
146   -- Example:
147   -- hr_api.mandatory_arg_error
148   --   (p_api_name       => l_proc,
149   --    p_argument       => 'object_version_number',
150   --    p_argument_value => p_object_version_number);
151   --
152   Open  C_Sel1;
153   Fetch C_Sel1 Into g_old_rec;
154   If C_Sel1%notfound then
155     Close C_Sel1;
156     --
157     -- The primary key is invalid therefore we must error
158     --
159     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
160     hr_utility.raise_error;
161   End If;
162   Close C_Sel1;
163   If (p_object_version_number <> g_old_rec.object_version_number) Then
164         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
165         hr_utility.raise_error;
166       End If;
167 --
168   hr_utility.set_location(' Leaving:'||l_proc, 10);
169 --
170 -- We need to trap the ORA LOCK exception
171 --
172 Exception
173   When HR_Api.Object_Locked then
174     --
175     -- The object is locked therefore we need to supply a meaningful
176     -- error message.
177     --
178     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
179     hr_utility.set_message_token('TABLE_NAME', 'pay_wci_occupations');
180     hr_utility.raise_error;
181 End lck;
182 --
183 -- ----------------------------------------------------------------------------
184 -- |-----------------------------< convert_args >-----------------------------|
185 -- ----------------------------------------------------------------------------
186 Function convert_args
187 	(
188 	p_occupation_id                 in number,
189 	p_business_group_id             in number,
190 	p_rate_id                       in number,
191 	p_job_id                        in number,
192 	p_comments                      in varchar2,
193 	p_object_version_number         in number
194 	)
195 	Return g_rec_type is
196 --
197   l_rec	  g_rec_type;
198   l_proc  varchar2(72) := g_package||'convert_args';
199 --
200 Begin
201   --
202   hr_utility.set_location('Entering:'||l_proc, 5);
203   --
204   -- Convert arguments into local l_rec structure.
205   --
206   l_rec.occupation_id                    := p_occupation_id;
207   l_rec.business_group_id                := p_business_group_id;
208   l_rec.rate_id                          := p_rate_id;
209   l_rec.job_id                           := p_job_id;
210   l_rec.comments                         := p_comments;
211   l_rec.object_version_number            := p_object_version_number;
212   --
213   -- Return the plsql record structure.
214   --
215   hr_utility.set_location(' Leaving:'||l_proc, 10);
216   Return(l_rec);
217 --
218 End convert_args;
219 --
220 end pay_pwo_shd;