[Home] [Help]
PACKAGE BODY: APPS.HXC_VTL_SHD
Source
1 Package Body hxc_vtl_shd as
2 /* $Header: hxcvtlrhi.pkb 120.2 2005/09/23 06:39:43 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_vtl_shd.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE
16 ) Is
17 --
18 l_proc varchar2(72) := g_package||'constraint_error';
19 --
20 Begin
21 --
22 If (p_constraint_name = 'HXC_ALIAS_VALUES_TL_PK') Then
23 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24 fnd_message.set_token('PROCEDURE', l_proc);
25 fnd_message.set_token('STEP','5');
26 fnd_message.raise_error;
27 Else
28 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
29 fnd_message.set_token('PROCEDURE', l_proc);
30 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
31 fnd_message.raise_error;
32 End If;
33 --
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40 (p_alias_value_id in number
41 ,p_language in varchar2
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 alias_value_id
50 ,alias_value_name
51 ,language
52 ,source_lang
53 from hxc_alias_values_tl
54 where alias_value_id = p_alias_value_id
55 and language = p_language;
56 --
57 l_fct_ret boolean;
58 --
59 Begin
60 --
61 If (p_alias_value_id is null or
62 p_language 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_alias_value_id
71 = hxc_vtl_shd.g_old_rec.alias_value_id and
72 p_language
73 = hxc_vtl_shd.g_old_rec.language
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 hxc_vtl_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 --
96 l_fct_ret := true;
97 End If;
98 End If;
99 Return (l_fct_ret);
100 --
101 End api_updating;
102 --
103 -- ----------------------------------------------------------------------------
104 -- |---------------------------------< lck >----------------------------------|
105 -- ----------------------------------------------------------------------------
106 Procedure lck
107 (p_alias_value_id in number
108 ,p_language in varchar2
109 ) is
110 --
111 -- Cursor selects the 'current' row from the HR Schema
112 --
113 Cursor C_Sel1 is
114 select
115 alias_value_id
116 ,alias_value_name
117 ,language
118 ,source_lang
119 from hxc_alias_values_tl
120 where alias_value_id = p_alias_value_id
121 and language = p_language
122 for update nowait;
123 --
124 l_proc varchar2(72) ;
125 --
126 Begin
127 g_debug :=hr_utility.debug_enabled;
128 if g_debug then
129 l_proc := g_package||'lck';
130 hr_utility.set_location('Entering:'||l_proc, 5);
131 end if;
132 --
133 hr_api.mandatory_arg_error
134 (p_api_name => l_proc
135 ,p_argument => 'ALIAS_VALUE_ID'
136 ,p_argument_value => p_alias_value_id
137 );
138 if g_debug then
139 hr_utility.set_location(l_proc,6);
140 end if;
141 hr_api.mandatory_arg_error
142 (p_api_name => l_proc
143 ,p_argument => 'LANGUAGE'
144 ,p_argument_value => p_language
145 );
146 --
147 Open C_Sel1;
148 Fetch C_Sel1 Into hxc_vtl_shd.g_old_rec;
149 If C_Sel1%notfound then
150 Close C_Sel1;
151 --
152 -- The primary key is invalid therefore we must error
153 --
154 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
155 fnd_message.raise_error;
156 End If;
157 Close C_Sel1;
158 --
159 --
160 if g_debug then
161 hr_utility.set_location(' Leaving:'||l_proc, 10);
162 end if;
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', 'hxc_alias_values_tl');
174 fnd_message.raise_error;
175 End lck;
176 --
177 -- ----------------------------------------------------------------------------
178 -- |----------------------------< add_language >------------------------------|
179 -- ----------------------------------------------------------------------------
180 --
181 -- EDIT_HERE: Execute AOL's tltblgen(UNIX) program to generate the
182 -- ADD_LANGUAGE procedure. Only the add_language procedure
183 -- should be added here. Remove the following skeleton
184 -- procedure.
185 --
186 -- ----------------------------------------------------------------------------
187 PROCEDURE add_language IS
188 Begin
189 --
190 delete from hxc_alias_values_tl t
191 where not exists
192 (select null
193 from hxc_alias_values_tl b
194 where b.alias_value_id = t.alias_value_id
195 );
196 --
197 update hxc_alias_values_tl t
198 set (alias_value_name) =
199 (select b.alias_value_name
200 from hxc_alias_values_tl b
201 where b.alias_value_id = t.alias_value_id
202 and b.language = t.source_lang)
203 where (t.alias_value_id
204 ,t.language)
205 in (select subt.alias_value_id
206 ,subt.language
207 from hxc_alias_values_tl subb
208 ,hxc_alias_values_tl subt
209 where subb.alias_value_id = subt.alias_value_id
210 and subb.language = subt.source_lang
211 and subb.alias_value_name <> subt.alias_value_name
212 );
213 --
214 insert into hxc_alias_values_tl
215 (alias_value_id
216 ,alias_value_name
217 ,language
218 ,source_lang
219 ,last_update_date
220 ,last_updated_by
221 ,last_update_login
222 ,created_by
223 ,creation_date
224 )
225 select b.alias_value_id
226 ,b.alias_value_name
227 ,l.language_code
228 ,b.source_lang
229 ,b.last_update_date
230 ,b.last_updated_by
231 ,b.last_update_login
232 ,b.created_by
233 ,b.creation_date
234 from hxc_alias_values_tl b
235 ,fnd_languages l
236 where l.installed_flag in ('I', 'B')
237 and b.language = userenv('LANG')
238 and not exists
239 (select null
240 from hxc_alias_values_tl t
241 where t.alias_value_id = b.alias_value_id
242 and t.language = l.language_code
243 );
244 --
245 End;
246 --
247 -- ----------------------------------------------------------------------------
248 -- |-----------------------------< convert_args >-----------------------------|
249 -- ----------------------------------------------------------------------------
250 Function convert_args
251 (p_alias_value_id in number
252 ,p_alias_value_name in varchar2
253 ,p_language in varchar2
254 ,p_source_lang in varchar2
255 )
256 Return g_rec_type is
257 --
258 l_rec g_rec_type;
259 --
260 Begin
261 --
262 -- Convert arguments into local l_rec structure.
263 --
264 l_rec.alias_value_id := p_alias_value_id;
265 l_rec.alias_value_name := p_alias_value_name;
266 l_rec.language := p_language;
267 l_rec.source_lang := p_source_lang;
268 --
269 -- Return the plsql record structure.
270 --
271 Return(l_rec);
272 --
273 End convert_args;
274 --
275 end hxc_vtl_shd;