DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_STR_SHD

Source


1 Package Body pqh_str_shd as
2 /* $Header: pqstrrhi.pkb 115.10 2004/04/06 05:49 svorugan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_str_shd.';  -- Global package name
9 
10 g_debug boolean := hr_utility.debug_enabled;
11 --
12 -- ----------------------------------------------------------------------------
13 -- |---------------------------< constraint_error >---------------------------|
14 -- ----------------------------------------------------------------------------
15 Procedure constraint_error
16   (p_constraint_name in all_constraints.constraint_name%TYPE
17   ) Is
18 --
19   l_proc        varchar2(72) := g_package||'constraint_error';
20 --
21 Begin
22   --
23   If (p_constraint_name = 'PQH_FR_STAT_SITUATION_RULES_PK') Then
24     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
25     fnd_message.set_token('PROCEDURE', l_proc);
26     fnd_message.set_token('STEP','5');
27     fnd_message.raise_error;
28   Else
29     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
30     fnd_message.set_token('PROCEDURE', l_proc);
31     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
32     fnd_message.raise_error;
33   End If;
34   --
35 End constraint_error;
36 --
37 -- ----------------------------------------------------------------------------
38 -- |-----------------------------< api_updating >-----------------------------|
39 -- ----------------------------------------------------------------------------
40 Function api_updating
41   (p_stat_situation_rule_id               in     number
42   ,p_object_version_number                in     number
43   )
44   Return Boolean Is
45   --
46   --
47   -- Cursor selects the 'current' row from the HR Schema
48   --
49   Cursor C_Sel1 is
50     select
51        stat_situation_rule_id
52       ,statutory_situation_id
53       ,processing_sequence
54       ,txn_category_attribute_id
55       ,from_value
56       ,to_value
57       ,enabled_flag
58       ,required_flag
59       ,exclude_flag
60       ,object_version_number
61     from        pqh_fr_stat_situation_rules
62     where       stat_situation_rule_id = p_stat_situation_rule_id;
63   --
64   l_fct_ret     boolean;
65   --
66 Begin
67   --
68   If (p_stat_situation_rule_id is null and
69       p_object_version_number is null
70      ) Then
71     --
72     -- One of the primary key arguments is null therefore we must
73     -- set the returning function value to false
74     --
75     l_fct_ret := false;
76   Else
77     If (p_stat_situation_rule_id
78         = pqh_str_shd.g_old_rec.stat_situation_rule_id and
79         p_object_version_number
80         = pqh_str_shd.g_old_rec.object_version_number
81        ) Then
82       --
83       -- The g_old_rec is current therefore we must
84       -- set the returning function to true
85       --
86       l_fct_ret := true;
87     Else
88       --
89       -- Select the current row into g_old_rec
90       --
91       Open C_Sel1;
92       Fetch C_Sel1 Into pqh_str_shd.g_old_rec;
93       If C_Sel1%notfound Then
94         Close C_Sel1;
95         --
96         -- The primary key is invalid therefore we must error
97         --
98         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
99         fnd_message.raise_error;
100       End If;
101       Close C_Sel1;
102       If (p_object_version_number
103           <> pqh_str_shd.g_old_rec.object_version_number) Then
104         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
105         fnd_message.raise_error;
106       End If;
107       l_fct_ret := true;
108     End If;
109   End If;
110   Return (l_fct_ret);
111 --
112 End api_updating;
113 --
114 -- ----------------------------------------------------------------------------
115 -- |---------------------------------< lck >----------------------------------|
116 -- ----------------------------------------------------------------------------
117 Procedure lck
118   (p_stat_situation_rule_id               in     number
119   ,p_object_version_number                in     number
120   ) is
121 --
122 -- Cursor selects the 'current' row from the HR Schema
123 --
124   Cursor C_Sel1 is
125     select
126        stat_situation_rule_id
127       ,statutory_situation_id
128       ,processing_sequence
129       ,txn_category_attribute_id
130       ,from_value
131       ,to_value
132       ,enabled_flag
133       ,required_flag
134       ,exclude_flag
135       ,object_version_number
136     from        pqh_fr_stat_situation_rules
137     where       stat_situation_rule_id = p_stat_situation_rule_id
138     for update nowait;
139 --
140   l_proc        varchar2(72) := g_package||'lck';
141 --
142 Begin
143 
144   if g_debug then
145   --
146   hr_utility.set_location('Entering:'||l_proc, 5);
147   --
148   End if;
149 
150   --
151   hr_api.mandatory_arg_error
152     (p_api_name           => l_proc
153     ,p_argument           => 'STAT_SITUATION_RULE_ID'
154     ,p_argument_value     => p_stat_situation_rule_id
155     );
156 
157   if g_debug then
158   --
159   hr_utility.set_location(l_proc,6);
160   --
161   End if;
162 
163   hr_api.mandatory_arg_error
164     (p_api_name           => l_proc
165     ,p_argument           => 'OBJECT_VERSION_NUMBER'
166     ,p_argument_value     => p_object_version_number
167     );
168   --
169   Open  C_Sel1;
170   Fetch C_Sel1 Into pqh_str_shd.g_old_rec;
171   If C_Sel1%notfound then
172     Close C_Sel1;
173     --
174     -- The primary key is invalid therefore we must error
175     --
176     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
177     fnd_message.raise_error;
178   End If;
179   Close C_Sel1;
180   If (p_object_version_number
181       <> pqh_str_shd.g_old_rec.object_version_number) Then
182         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
183         fnd_message.raise_error;
184   End If;
185   --
186   if g_debug then
187   --
188   hr_utility.set_location(' Leaving:'||l_proc, 10);
189   --
190   End if;
191 
192   --
193   -- We need to trap the ORA LOCK exception
194   --
195 Exception
196   When HR_Api.Object_Locked then
197     --
198     -- The object is locked therefore we need to supply a meaningful
199     -- error message.
200     --
201     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
202     fnd_message.set_token('TABLE_NAME', 'pqh_fr_stat_situation_rules');
203     fnd_message.raise_error;
204 End lck;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |-----------------------------< convert_args >-----------------------------|
208 -- ----------------------------------------------------------------------------
209 Function convert_args
210   (p_stat_situation_rule_id         in number
211   ,p_statutory_situation_id         in number
212   ,p_processing_sequence            in number
213   ,p_txn_category_attribute_id      in number
214   ,p_from_value                     in varchar2
215   ,p_to_value                       in varchar2
216   ,p_enabled_flag                   in varchar2
217   ,p_required_flag                  in varchar2
218   ,p_exclude_flag                   in varchar2
219   ,p_object_version_number          in number
220   )
221   Return g_rec_type is
222 --
223   l_rec   g_rec_type;
224 --
225 Begin
226   --
227   -- Convert arguments into local l_rec structure.
228   --
229   l_rec.stat_situation_rule_id           := p_stat_situation_rule_id;
230   l_rec.statutory_situation_id           := p_statutory_situation_id;
231   l_rec.processing_sequence              := p_processing_sequence;
232   l_rec.txn_category_attribute_id        := p_txn_category_attribute_id;
233   l_rec.from_value                       := p_from_value;
234   l_rec.to_value                         := p_to_value;
235   l_rec.enabled_flag                     := p_enabled_flag;
236   l_rec.required_flag                    := p_required_flag;
237   l_rec.exclude_flag                     := p_exclude_flag;
238   l_rec.object_version_number            := p_object_version_number;
239   --
240   -- Return the plsql record structure.
241   --
242   Return(l_rec);
243 --
244 End convert_args;
245 --
246 end pqh_str_shd;