DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_RSS_SHD

Source


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