[Home] [Help]
PACKAGE BODY: APPS.IRC_VCE_SHD
Source
1 Package Body irc_vce_shd as
2 /* $Header: irvcerhi.pkb 120.1 2005/12/13 06:42:58 cnholmes noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' irc_vce_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_VARIABLE_COMP_ELEMENTS_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_vacancy_id in number
51 ,p_variable_comp_lookup in varchar2
52 ,p_object_version_number in number
53 )
54 Return Boolean Is
55 --
56 --
57 -- Cursor selects the 'current' row from the HR Schema
58 --
59 Cursor C_Sel1 is
60 select
61 vacancy_id
62 ,variable_comp_lookup
63 ,object_version_number
64 from irc_variable_comp_elements
65 where vacancy_id = p_vacancy_id
66 and variable_comp_lookup = p_variable_comp_lookup;
67 --
68 l_fct_ret boolean;
69 --
70 Begin
71 --
72 If (p_object_version_number is null
73 ) Then
74 --
75 -- One of the primary key arguments is null therefore we must
76 -- set the returning function value to false
77 --
78 l_fct_ret := false;
79 Else
80 If (p_vacancy_id
81 = irc_vce_shd.g_old_rec.vacancy_id and
82 p_variable_comp_lookup
83 = irc_vce_shd.g_old_rec.variable_comp_lookup and
84 p_object_version_number
85 = irc_vce_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_vce_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_vce_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_vacancy_id in number
124 ,p_variable_comp_lookup in varchar2
125 ,p_object_version_number in number
126 ) is
127 --
128 -- Cursor selects the 'current' row from the HR Schema
129 --
130 Cursor C_Sel1 is
131 select
132 vacancy_id
133 ,variable_comp_lookup
134 ,object_version_number
135 from irc_variable_comp_elements
136 where vacancy_id = p_vacancy_id
137 and variable_comp_lookup = p_variable_comp_lookup
138 for update nowait;
139 --
140 l_proc varchar2(72) := g_package||'lck';
141 --
142 Begin
143 hr_utility.set_location('Entering:'||l_proc, 5);
144 --
145 hr_api.mandatory_arg_error
146 (p_api_name => l_proc
147 ,p_argument => 'VACANCY_ID'
148 ,p_argument_value => p_vacancy_id
149 );
150 hr_utility.set_location(l_proc,6);
151 hr_api.mandatory_arg_error
152 (p_api_name => l_proc
153 ,p_argument => 'VARIABLE_COMP_LOOKUP'
154 ,p_argument_value => p_variable_comp_lookup
155 );
156 hr_utility.set_location(l_proc,7);
157 hr_api.mandatory_arg_error
158 (p_api_name => l_proc
159 ,p_argument => 'OBJECT_VERSION_NUMBER'
160 ,p_argument_value => p_object_version_number
161 );
162 --
163 Open C_Sel1;
164 Fetch C_Sel1 Into irc_vce_shd.g_old_rec;
165 If C_Sel1%notfound then
166 Close C_Sel1;
167 --
168 -- The primary key is invalid therefore we must error
169 --
170 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
171 fnd_message.raise_error;
172 End If;
173 Close C_Sel1;
174 If (p_object_version_number
175 <> irc_vce_shd.g_old_rec.object_version_number) Then
176 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
177 fnd_message.raise_error;
178 End If;
179 --
180 hr_utility.set_location(' Leaving:'||l_proc, 10);
181 --
182 -- We need to trap the ORA LOCK exception
183 --
184 Exception
185 When HR_Api.Object_Locked then
186 --
187 -- The object is locked therefore we need to supply a meaningful
188 -- error message.
189 --
190 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
191 fnd_message.set_token('TABLE_NAME', 'irc_variable_comp_elements');
192 fnd_message.raise_error;
193 End lck;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< convert_args >-----------------------------|
197 -- ----------------------------------------------------------------------------
198 Function convert_args
199 (p_vacancy_id in number
200 ,p_variable_comp_lookup 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.vacancy_id := p_vacancy_id;
212 l_rec.variable_comp_lookup := p_variable_comp_lookup;
213 l_rec.object_version_number := p_object_version_number;
214 --
215 -- Return the plsql record structure.
216 --
217 Return(l_rec);
218 --
219 End convert_args;
220 --
221 end irc_vce_shd;