DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_ETM_SHD

Source


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