DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_IOS_SHD

Source


1 Package Body irc_ios_shd as
2 /* $Header: iriosrhi.pkb 120.3.12010000.2 2008/11/09 06:41:05 vmummidi ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_ios_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 = 'IRC_OFFER_STATUS_HISTORY_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 = 'SYS_C00196112') 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 = 'IRC_OFFER_STATUS_HISTORY_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_offer_status_history_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        offer_status_history_id
60       ,offer_id
61       ,status_change_date
62       ,offer_status
63       ,change_reason
64       ,decline_reason
65       ,object_version_number
66     from        irc_offer_status_history
67     where       offer_status_history_id = p_offer_status_history_id;
68   --
69   l_fct_ret     boolean;
70   --
71 Begin
72   --
73   If (p_offer_status_history_id is null and
74       p_object_version_number is null
75      ) Then
76     --
77     -- One of the primary key arguments is null therefore we must
78     -- set the returning function value to false
79     --
80     l_fct_ret := false;
81   Else
82     If (p_offer_status_history_id
83         = irc_ios_shd.g_old_rec.offer_status_history_id and
84         p_object_version_number
85         = irc_ios_shd.g_old_rec.object_version_number
86        ) Then
87       --
88       -- The g_old_rec is current therefore we must
89       -- set the returning function to true
90       --
91       l_fct_ret := true;
92     Else
93       --
94       -- Select the current row into g_old_rec
95       --
96       Open C_Sel1;
97       Fetch C_Sel1 Into irc_ios_shd.g_old_rec;
98       If C_Sel1%notfound Then
99         Close C_Sel1;
100         --
101         -- The primary key is invalid therefore we must error
102         --
103         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
104         fnd_message.raise_error;
105       End If;
106       Close C_Sel1;
107       If (p_object_version_number
108           <> irc_ios_shd.g_old_rec.object_version_number) Then
109         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
110         fnd_message.raise_error;
111       End If;
112       l_fct_ret := true;
113     End If;
114   End If;
115   Return (l_fct_ret);
116 --
117 End api_updating;
118 --
119 -- ----------------------------------------------------------------------------
120 -- |---------------------------------< lck >----------------------------------|
121 -- ----------------------------------------------------------------------------
122 Procedure lck
123   (p_offer_status_history_id              in     number
124   ,p_object_version_number                in     number
125   ) is
126 --
127 -- Cursor selects the 'current' row from the HR Schema
128 --
129   Cursor C_Sel1 is
130     select
131        offer_status_history_id
132       ,offer_id
133       ,status_change_date
134       ,offer_status
135       ,change_reason
136       ,decline_reason
137       ,object_version_number
138     from        irc_offer_status_history
139     where       offer_status_history_id = p_offer_status_history_id
140     for update nowait;
141 --
142   l_proc        varchar2(72) := g_package||'lck';
143 --
144 Begin
145   hr_utility.set_location('Entering:'||l_proc, 5);
146   --
147   hr_api.mandatory_arg_error
148     (p_api_name           => l_proc
149     ,p_argument           => 'OFFER_STATUS_HISTORY_ID'
150     ,p_argument_value     => p_offer_status_history_id
151     );
152   hr_utility.set_location(l_proc,6);
153   hr_api.mandatory_arg_error
154     (p_api_name           => l_proc
155     ,p_argument           => 'OBJECT_VERSION_NUMBER'
156     ,p_argument_value     => p_object_version_number
157     );
158   --
159   Open  C_Sel1;
160   Fetch C_Sel1 Into irc_ios_shd.g_old_rec;
161   If C_Sel1%notfound then
162     Close C_Sel1;
163     --
164     -- The primary key is invalid therefore we must error
165     --
166     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
167     fnd_message.raise_error;
168   End If;
169   Close C_Sel1;
170   If (p_object_version_number
171       <> irc_ios_shd.g_old_rec.object_version_number) Then
172         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
173         fnd_message.raise_error;
174   End If;
175   --
176   hr_utility.set_location(' Leaving:'||l_proc, 10);
177   --
178   -- We need to trap the ORA LOCK exception
179   --
180 Exception
181   When HR_Api.Object_Locked then
182     --
183     -- The object is locked therefore we need to supply a meaningful
184     -- error message.
185     --
186     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
187     fnd_message.set_token('TABLE_NAME', 'irc_offer_status_history');
188     fnd_message.raise_error;
189 End lck;
190 --
191 -- ----------------------------------------------------------------------------
192 -- |-----------------------------< convert_args >-----------------------------|
193 -- ----------------------------------------------------------------------------
194 Function convert_args
195   (p_offer_status_history_id        in number
196   ,p_offer_id                       in number
197   ,p_status_change_date             in date
198   ,p_offer_status                   in varchar2
199   ,p_change_reason                  in varchar2
200   ,p_decline_reason                 in varchar2
201   ,p_object_version_number          in number
202   )
203   Return g_rec_type is
204 --
205   l_rec   g_rec_type;
206 --
207 Begin
208   --
209   -- Convert arguments into local l_rec structure.
210   --
211   l_rec.offer_status_history_id          := p_offer_status_history_id;
212   l_rec.offer_id                         := p_offer_id;
213   l_rec.status_change_date               := p_status_change_date;
214   l_rec.offer_status                     := p_offer_status;
215   l_rec.change_reason                    := p_change_reason;
216   l_rec.decline_reason                   := p_decline_reason;
217   l_rec.object_version_number            := p_object_version_number;
218   --
219   -- Return the plsql record structure.
220   --
221   Return(l_rec);
222 --
223 End convert_args;
224 --
225 end irc_ios_shd;