DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_RHA_SHD

Source


1 Package Body pqh_rha_shd as
2 /* $Header: pqrharhi.pkb 120.1 2005/08/03 13:43:25 nsanghal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqh_rha_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_ROUTING_HIST_ATTRIBS_FK1') 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_ROUTING_HIST_ATTRIBS_FK2') 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   ElsIf (p_constraint_name = 'PQH_ROUTING_HIST_ATTRIBS_PK') Then
32     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('STEP','15');
35     fnd_message.raise_error;
36   Else
37     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
40     fnd_message.raise_error;
41   End If;
42   --
43 End constraint_error;
44 --
45 -- ----------------------------------------------------------------------------
46 -- |-----------------------------< api_updating >-----------------------------|
47 -- ----------------------------------------------------------------------------
48 Function api_updating
49   (p_routing_hist_attrib_id               in     number
50   ,p_object_version_number                in     number
51   )
52   Return Boolean Is
53 --
54   --
55   -- Cursor selects the 'current' row from the HR Schema
56   --
57   Cursor C_Sel1 is
58     select
59        routing_hist_attrib_id
60       ,routing_history_id
61       ,attribute_id
62       ,from_char
63       ,from_date
64       ,from_number
65       ,to_char
66       ,to_date
67       ,to_number
68       ,object_version_number
69       ,range_type_cd
70       ,value_date
71       ,value_number
72       ,value_char
73     from	pqh_routing_hist_attribs
74     where	routing_hist_attrib_id = p_routing_hist_attrib_id;
75 --
76   l_fct_ret	boolean;
77 --
78 Begin
79   --
80   If (p_routing_hist_attrib_id is null and
81       p_object_version_number is null
82      ) Then
83     --
84     -- One of the primary key arguments is null therefore we must
85     -- set the returning function value to false
86     --
87     l_fct_ret := false;
88   Else
89     If (p_routing_hist_attrib_id
90         = pqh_rha_shd.g_old_rec.routing_hist_attrib_id and
91         p_object_version_number
92         = pqh_rha_shd.g_old_rec.object_version_number
93        ) Then
94       --
95       -- The g_old_rec is current therefore we must
96       -- set the returning function to true
97       --
98       l_fct_ret := true;
99     Else
100       --
101       -- Select the current row into g_old_rec
102       --
103       Open C_Sel1;
104       Fetch C_Sel1 Into pqh_rha_shd.g_old_rec;
105       If C_Sel1%notfound Then
106         Close C_Sel1;
107         --
108         -- The primary key is invalid therefore we must error
109         --
110         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
111         fnd_message.raise_error;
112       End If;
113       Close C_Sel1;
114       If (p_object_version_number
115           <> pqh_rha_shd.g_old_rec.object_version_number) Then
116         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
117         fnd_message.raise_error;
118       End If;
119       l_fct_ret := true;
120     End If;
121   End If;
122   Return (l_fct_ret);
123 --
124 End api_updating;
125 --
126 -- ----------------------------------------------------------------------------
127 -- |---------------------------------< lck >----------------------------------|
128 -- ----------------------------------------------------------------------------
129 Procedure lck
130   (p_routing_hist_attrib_id               in     number
131   ,p_object_version_number                in     number
132   ) is
133 --
134 -- Cursor selects the 'current' row from the HR Schema
135 --
136   Cursor C_Sel1 is
137     select
138        routing_hist_attrib_id
139       ,routing_history_id
140       ,attribute_id
141       ,from_char
142       ,from_date
143       ,from_number
144       ,to_char
145       ,to_date
146       ,to_number
147       ,object_version_number
148       ,range_type_cd
149       ,value_date
150       ,value_number
151       ,value_char
152     from	pqh_routing_hist_attribs
153     where	routing_hist_attrib_id = p_routing_hist_attrib_id
154     for	update nowait;
155 --
156   l_proc	varchar2(72) := g_package||'lck';
157 --
158 Begin
159   hr_utility.set_location('Entering:'||l_proc, 5);
160   --
161   hr_api.mandatory_arg_error
162     (p_api_name           => l_proc
163     ,p_argument           => 'ROUTING_HIST_ATTRIB_ID'
164     ,p_argument_value     => p_routing_hist_attrib_id
165     );
166   --
167   Open  C_Sel1;
168   Fetch C_Sel1 Into pqh_rha_shd.g_old_rec;
169   If C_Sel1%notfound then
170     Close C_Sel1;
171     --
172     -- The primary key is invalid therefore we must error
173     --
174     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
175     fnd_message.raise_error;
176   End If;
177   Close C_Sel1;
178   If (p_object_version_number
179       <> pqh_rha_shd.g_old_rec.object_version_number) Then
180         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
181         fnd_message.raise_error;
182   End If;
183   --
184   hr_utility.set_location(' Leaving:'||l_proc, 10);
185   --
186   -- We need to trap the ORA LOCK exception
187   --
188 Exception
189   When HR_Api.Object_Locked then
190     --
191     -- The object is locked therefore we need to supply a meaningful
192     -- error message.
193     --
194     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
195     fnd_message.set_token('TABLE_NAME', 'pqh_routing_hist_attribs');
196     fnd_message.raise_error;
197 End lck;
198 --
199 -- ----------------------------------------------------------------------------
200 -- |-----------------------------< convert_args >-----------------------------|
201 -- ----------------------------------------------------------------------------
202 Function convert_args
203   (p_routing_hist_attrib_id         in number
204   ,p_routing_history_id             in number
205   ,p_attribute_id                   in number
206   ,p_from_char                      in varchar2
207   ,p_from_date                      in date
208   ,p_from_number                    in number
209   ,p_to_char                        in varchar2
210   ,p_to_date                        in date
211   ,p_to_number                      in number
212   ,p_object_version_number          in number
213   ,p_range_type_cd                  in varchar2
214   ,p_value_date                     in date
215   ,p_value_number                   in number
216   ,p_value_char                     in varchar2
217   )
218   Return g_rec_type is
219 --
220   l_rec   g_rec_type;
221 --
222 Begin
223   --
224   -- Convert arguments into local l_rec structure.
225   --
226   l_rec.routing_hist_attrib_id           := p_routing_hist_attrib_id;
227   l_rec.routing_history_id               := p_routing_history_id;
228   l_rec.attribute_id                     := p_attribute_id;
229   l_rec.from_char                        := p_from_char;
230   l_rec.from_date                        := p_from_date;
231   l_rec.from_number                      := p_from_number;
232   l_rec.to_char                          := p_to_char;
233   l_rec.to_date                          := p_to_date;
234   l_rec.to_number                        := p_to_number;
235   l_rec.object_version_number            := p_object_version_number;
236   l_rec.range_type_cd                    := p_range_type_cd;
237   l_rec.value_date                       := p_value_date;
238   l_rec.value_number                     := p_value_number;
239   l_rec.value_char                       := p_value_char;
240   --
241   -- Return the plsql record structure.
242   --
243   Return(l_rec);
244 --
245 End convert_args;
246 --
247 end pqh_rha_shd;