DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_RAV_SHD

Source


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