DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_LVL_SHD

Source


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