[Home] [Help]
PACKAGE BODY: APPS.PA_FP_SPREAD_CURVES_PKG
Source
1 package body PA_FP_SPREAD_CURVES_PKG as
2 /* $Header: PAFPSCTB.pls 120.1 2005/08/19 16:30:03 mwasowic noship $ */
3
4 g_module_name VARCHAR2(100) := 'pa.plsql.pa_fp_spread_curves_pkg';
5
6 /*==================================================================
7 This api locks the row in Pa_Spread_Curves_B before updating
8 ==================================================================*/
9
10 procedure LOCK_ROW (
11 p_spread_curve_id IN Pa_spread_curves_b.spread_curve_id%TYPE,
12 p_RECORD_VERSION_NUMBER IN pa_spread_curves_b.RECORD_VERSION_NUMBER%TYPE
13 ) is
14
15 cursor c is
16 select RECORD_VERSION_NUMBER
17 from PA_SPREAD_CURVES_B
18 where SPREAD_CURVE_ID = p_spread_curve_id
19 for update of spread_curve_id nowait;
20
21 recinfo c%rowtype;
22
23 begin
24
25 open c;
26 fetch c into recinfo;
27 if (c%notfound) then
28 close c;
29 fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
30 app_exception.raise_exception;
31 end if;
32 close c;
33
34 if recinfo.RECORD_VERSION_NUMBER = p_RECORD_VERSION_NUMBER then
35 null;
36 else
37 fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
38 app_exception.raise_exception;
39 end if;
40
41 return;
42
43 end LOCK_ROW;
44
45 procedure DELETE_ROW (
46 p_spread_curve_id in Pa_spread_curves_b.spread_curve_id%TYPE
47 ) is
48 begin
49 delete from PA_SPREAD_CURVES_TL
50 where spread_curve_id = p_spread_curve_id;
51
52 if (sql%notfound) then
53 raise no_data_found;
54 end if;
55
56 delete from PA_SPREAD_CURVES_B
57 where spread_curve_id = p_spread_curve_id;
58
59 if (sql%notfound) then
60 raise no_data_found;
61 end if;
62 end DELETE_ROW;
63
64
65 Procedure Insert_Row (
66 X_Rowid IN OUT NOCOPY Rowid, --File.Sql.39 bug 4440895
67 X_Spread_Curve_Id IN Pa_Spread_Curves_B.Spread_Curve_Id%Type,
68 X_Spread_Curve_Code IN Pa_Spread_Curves_B.Spread_Curve_Code%Type,
69 X_Record_Version_Number IN Pa_Spread_Curves_B.Record_Version_Number%Type,
70 X_Name IN Pa_Spread_Curves_Tl.Name%Type,
71 X_Description IN Pa_Spread_Curves_Tl.Description%Type,
72 X_Effective_Start_Date IN Pa_Spread_Curves_B.Effective_Start_Date%Type,
73 X_Effective_End_Date IN Pa_Spread_Curves_B.Effective_End_Date%Type,
74 X_Rounding_Factor_Code IN Pa_Spread_Curves_B.Rounding_Factor_Code%Type,
75 X_Point1 IN Pa_Spread_Curves_B.Point1%Type,
76 X_Point2 IN Pa_Spread_Curves_B.Point2%Type,
77 X_Point3 IN Pa_Spread_Curves_B.Point3%Type,
78 X_Point4 IN Pa_Spread_Curves_B.Point4%Type,
79 X_Point5 IN Pa_Spread_Curves_B.Point5%Type,
80 X_Point6 IN Pa_Spread_Curves_B.Point6%Type,
81 X_Point7 IN Pa_Spread_Curves_B.Point7%Type,
82 X_Point8 IN Pa_Spread_Curves_B.Point8%Type,
83 X_Point9 IN Pa_Spread_Curves_B.Point9%Type,
84 X_Point10 IN Pa_Spread_Curves_B.Point10%Type,
85 X_Last_Update_Date IN Pa_Spread_Curves_B.Last_Update_Date%Type,
86 X_Last_Updated_By IN Pa_Spread_Curves_B.Last_Updated_By%Type,
87 X_Creation_Date IN Pa_Spread_Curves_B.Creation_Date%Type,
88 X_Created_By IN Pa_Spread_Curves_B.Created_By%Type,
89 X_Last_Update_Login IN Pa_Spread_Curves_B.Last_Update_Login%Type,
90 X_Return_Status OUT NOCOPY Varchar2, --File.Sql.39 bug 4440895
91 X_Msg_Data OUT NOCOPY Varchar2, --File.Sql.39 bug 4440895
92 X_Msg_Count OUT NOCOPY Number --File.Sql.39 bug 4440895
93 )is
94
95 l_spread_curve_id pa_spread_curves_b.SPREAD_CURVE_ID%type;
96
97 cursor C is select ROWID from pa_spread_curves_b
98 where SPREAD_CURVE_ID = l_spread_curve_id;
99
100 l_return_status VARCHAR2(1) := NULL;
101 l_msg_count NUMBER := 0;
102 l_data VARCHAR2(2000) := NULL;
103 l_msg_data VARCHAR2(2000) := NULL;
104 l_msg_index_out NUMBER;
105 l_debug_mode VARCHAR2(1) := Null;
106
107 BEGIN
108
109 x_msg_count := 0;
110 x_return_status := FND_API.G_RET_STS_SUCCESS;
111 l_debug_mode := NVL(FND_PROFILE.value('PA_DEBUG_MODE'),'N');
112
113 IF l_debug_mode = 'Y' THEN
114 pa_debug.set_curr_function( p_function => 'validate',
115 p_debug_mode => l_debug_mode );
116 END IF;
117
118 select nvl(X_SPREAD_CURVE_ID,PA_SPREAD_CURVES_S.nextval)
119 into l_spread_curve_id
120 from dual;
121
122 IF l_debug_mode = 'Y' THEN
123 pa_debug.g_err_stage:= 'Inserting record in Pa_Spread_Curves_B'||to_char(l_spread_Curve_id);
124 pa_debug.write(g_module_name,pa_debug.g_err_stage,
125 pa_fp_constants_pkg.g_debug_level3);
126 END IF;
127
128 INSERT INTO Pa_Spread_Curves_B
129 (
130 Spread_Curve_Id ,
131 Spread_Curve_Code ,
132 Record_Version_Number ,
133 Effective_Start_Date ,
134 Effective_End_Date ,
135 Rounding_Factor_Code ,
136 Point1 ,
137 Point2 ,
138 Point3 ,
139 Point4 ,
140 Point5 ,
141 Point6 ,
142 Point7 ,
143 Point8 ,
144 Point9 ,
145 Point10 ,
146 Last_Update_Date ,
147 Last_Updated_By ,
148 Creation_Date ,
149 Created_By ,
150 Last_Update_Login
151 )
152 VALUES
153 (
154 L_Spread_Curve_Id ,
155 X_Spread_Curve_Code ,
156 1 ,
157 X_Effective_Start_Date ,
158 X_Effective_End_Date ,
159 X_Rounding_Factor_Code ,
160 nvl(X_Point1,0) ,
161 nvl(X_Point2,0) ,
162 nvl(X_Point3,0) ,
163 nvl(X_Point4,0) ,
164 nvl(X_Point5,0) ,
165 nvl(X_Point6,0) ,
166 nvl(X_Point7,0) ,
167 nvl(X_Point8,0) ,
168 nvl(X_Point9,0) ,
169 nvl(X_Point10,0) ,
170 X_Last_Update_Date ,
171 X_Last_Updated_By ,
172 X_Creation_Date ,
173 X_Created_By ,
174 X_Last_Update_Login
175 );
176
177 IF l_debug_mode = 'Y' THEN
178 pa_debug.g_err_stage:= 'Inserting record in Pa_Spread_Curves_TL'||to_char(l_spread_Curve_id);
179 pa_debug.write(g_module_name,pa_debug.g_err_stage, pa_fp_constants_pkg.g_debug_level3);
180 END IF;
181
182 INSERT INTO Pa_Spread_Curves_TL
183 (
184 Spread_Curve_Id,
185 Name,
186 Description,
187 Last_Update_Date,
188 Last_Updated_By,
189 Creation_Date,
190 Created_By,
191 Last_Update_Login,
192 Language,
193 Source_Lang
194 )
195 SELECT
196 L_Spread_Curve_Id,
197 X_Name,
198 X_Description,
199 X_Last_Update_Date,
200 X_Last_Updated_By,
201 X_Creation_Date,
202 X_Created_By,
203 X_Last_Update_Login,
204 L.Language_Code,
205 Userenv('Lang')
206 FROM Fnd_Languages L
207 WHERE L.Installed_Flag In ('I', 'B')
208 AND NOT EXISTS
209 (SELECT NULL FROM Pa_Spread_Curves_Tl T
210 WHERE T.Spread_Curve_Id = L_Spread_Curve_Id
211 AND T.Language = L.Language_Code);
212
213 OPEN C;
214 FETCH C INTO X_ROWID;
215 IF (C%NOTFOUND) THEN
216
217 CLOSE C;
218 IF l_debug_mode = 'Y' THEN
219 pa_debug.g_err_stage:= 'Rowid could not be fetched after Inserting for'||to_char(l_spread_Curve_id);
220 pa_debug.write(g_module_name,pa_debug.g_err_stage, pa_fp_constants_pkg.g_debug_level5);
221 END IF;
222 RAISE NO_DATA_FOUND;
223
224 END IF;
225 CLOSE C;
226
227 EXCEPTION
228 WHEN NO_DATA_FOUND THEN
229
230 x_return_status := FND_API.G_RET_STS_ERROR;
231 l_msg_count := FND_MSG_PUB.count_msg;
232
233 IF l_msg_count = 1 and x_msg_data IS NULL THEN
234 PA_INTERFACE_UTILS_PUB.get_messages
235 (p_encoded => FND_API.G_TRUE
236 ,p_msg_index => 1
237 ,p_msg_count => l_msg_count
238 ,p_msg_data => l_msg_data
239 ,p_data => l_data
240 ,p_msg_index_out => l_msg_index_out);
241 x_msg_data := l_data;
242 x_msg_count := l_msg_count;
243 ELSE
244 x_msg_count := l_msg_count;
245 END IF;
246
247 IF l_debug_mode = 'Y' THEN
248 pa_debug.reset_curr_function;
249 END IF;
250
251 RETURN;
252
253 WHEN others THEN
254
255 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
256 x_msg_count := 1;
257 x_msg_data := SQLERRM;
258
259 FND_MSG_PUB.add_exc_msg
260 ( p_pkg_name => 'PA_FP_SPREAD_CURVES_PKG'
261 ,p_procedure_name => 'Insert Row'
262 ,p_error_text => x_msg_data);
263
264 IF l_debug_mode = 'Y' THEN
265 pa_debug.g_err_stage:= 'Unexpected Error'||x_msg_data;
266 pa_debug.write(g_module_name,pa_debug.g_err_stage,
267 pa_fp_constants_pkg.g_debug_level5);
268 pa_debug.reset_curr_function;
269 END IF;
270
271 RAISE;
272
273 END Insert_Row;
274
275
276 Procedure Update_Row (
277 X_Spread_Curve_Id IN Pa_Spread_Curves_B.Spread_Curve_Id%Type,
278 X_Spread_Curve_Code IN Pa_Spread_Curves_B.Spread_Curve_Code%Type,
279 X_Record_Version_Number IN Pa_Spread_Curves_B.Record_Version_Number%Type,
280 X_Name IN Pa_Spread_Curves_Tl.Name%Type,
281 X_Description IN Pa_Spread_Curves_Tl.Description%Type,
282 X_Effective_Start_Date IN Pa_Spread_Curves_B.Effective_Start_Date%Type,
283 X_Effective_End_Date IN Pa_Spread_Curves_B.Effective_End_Date%Type,
284 X_Rounding_Factor_Code IN Pa_Spread_Curves_B.Rounding_Factor_Code%Type,
285 X_Point1 IN Pa_Spread_Curves_B.Point1%Type,
286 X_Point2 IN Pa_Spread_Curves_B.Point2%Type,
287 X_Point3 IN Pa_Spread_Curves_B.Point3%Type,
288 X_Point4 IN Pa_Spread_Curves_B.Point4%Type,
289 X_Point5 IN Pa_Spread_Curves_B.Point5%Type,
290 X_Point6 IN Pa_Spread_Curves_B.Point6%Type,
291 X_Point7 IN Pa_Spread_Curves_B.Point7%Type,
292 X_Point8 IN Pa_Spread_Curves_B.Point8%Type,
293 X_Point9 IN Pa_Spread_Curves_B.Point9%Type,
294 X_Point10 IN Pa_Spread_Curves_B.Point10%Type,
295 X_Last_Update_Date IN Pa_Spread_Curves_B.Last_Update_Date%Type,
296 X_Last_Updated_By IN Pa_Spread_Curves_B.Last_Updated_By%Type,
297 X_Last_Update_Login IN Pa_Spread_Curves_B.Last_Update_Login%Type,
298 X_Return_Status OUT NOCOPY Varchar2, --File.Sql.39 bug 4440895
299 X_Msg_Data OUT NOCOPY Varchar2, --File.Sql.39 bug 4440895
300 X_Msg_Count OUT NOCOPY Number --File.Sql.39 bug 4440895
301 ) IS
302
303 l_return_status VARCHAR2(1) := NULL;
304 l_msg_count NUMBER := 0;
305 l_data VARCHAR2(2000) := NULL;
306 l_msg_data VARCHAR2(2000) := NULL;
307 l_msg_index_out NUMBER;
308 l_debug_mode VARCHAR2(1) := Null;
309
310 BEGIN
311
312 x_msg_count := 0;
313 x_return_status := FND_API.G_RET_STS_SUCCESS;
314 l_debug_mode := NVL(FND_PROFILE.value('PA_DEBUG_MODE'),'N');
315
316 IF l_debug_mode = 'Y' THEN
317 pa_debug.set_curr_function( p_function => 'validate',
318 p_debug_mode => l_debug_mode );
319 END IF;
320
321 IF l_debug_mode = 'Y' THEN
322 pa_debug.g_err_stage:= 'Updating Pa_Spread_Curves_B for'||to_char(X_spread_Curve_id);
323 pa_debug.write(g_module_name,pa_debug.g_err_stage,pa_fp_constants_pkg.g_debug_level3);
324 END IF;
325
326 UPDATE Pa_Spread_Curves_B
327 SET Spread_Curve_Code = X_Spread_Curve_Code,
328 Effective_Start_Date = X_Effective_Start_Date,
329 Effective_End_Date = X_Effective_End_Date,
330 Record_Version_Number = Record_Version_Number + 1,
331 Rounding_Factor_Code = X_Rounding_Factor_Code,
332 Point1 = nvl(X_Point1,0),
333 Point2 = nvl(X_Point2,0),
334 Point3 = nvl(X_Point3,0),
335 Point4 = nvl(X_Point4,0),
336 Point5 = nvl(X_Point5,0),
337 Point6 = nvl(X_Point6,0),
338 Point7 = nvl(X_Point7,0),
339 Point8 = nvl(X_Point8,0),
340 Point9 = nvl(X_Point9,0),
341 Point10 = nvl(X_Point10,0),
342 Last_Update_Date = X_Last_Update_Date,
343 Last_Updated_By = X_Last_Updated_By,
344 Last_Update_Login = X_Last_Update_Login
345 Where Spread_Curve_Id = X_Spread_Curve_Id;
346
347 IF (SQL%NOTFOUND) THEN
348 IF l_debug_mode = 'Y' THEN
349 pa_debug.g_err_stage:= 'NDF while updating Pa_Spread_Curves_B'||to_char(X_spread_Curve_id);
350 pa_debug.write(g_module_name,pa_debug.g_err_stage, pa_fp_constants_pkg.g_debug_level5);
351 END IF;
352 RAISE NO_DATA_FOUND;
353 END IF;
354
355 IF l_debug_mode = 'Y' THEN
356 pa_debug.g_err_stage:= 'Updating Pa_Spread_Curves_TL for'||to_char(X_spread_Curve_id);
357 pa_debug.write(g_module_name,pa_debug.g_err_stage,pa_fp_constants_pkg.g_debug_level3);
358 END IF;
359
360 UPDATE Pa_Spread_Curves_TL
361 SET Name = X_Name,
362 Description = X_Description,
363 Last_Update_Date = X_Last_Update_Date,
364 Last_Updated_By = X_Last_Updated_By,
365 Last_Update_Login = X_Last_Update_Login,
366 Source_Lang = Userenv('Lang')
367 WHERE Spread_Curve_Id = X_Spread_Curve_Id
368 AND Userenv('Lang') In (Language, Source_Lang);
369
370 IF (SQL%NOTFOUND) THEN
371 IF l_debug_mode = 'Y' THEN
372 pa_debug.g_err_stage:= 'NDF while updating Pa_Spread_Curves_T'||to_char(X_spread_Curve_id);
373 pa_debug.write(g_module_name,pa_debug.g_err_stage, pa_fp_constants_pkg.g_debug_level5);
374 END IF;
375 RAISE NO_DATA_FOUND;
376 END IF;
377
378 EXCEPTION
379 WHEN NO_DATA_FOUND THEN
380
381 x_return_status := FND_API.G_RET_STS_ERROR;
382 l_msg_count := FND_MSG_PUB.count_msg;
383
384 IF l_msg_count = 1 and x_msg_data IS NULL THEN
385 PA_INTERFACE_UTILS_PUB.get_messages
386 (p_encoded => FND_API.G_TRUE
387 ,p_msg_index => 1
388 ,p_msg_count => l_msg_count
389 ,p_msg_data => l_msg_data
390 ,p_data => l_data
391 ,p_msg_index_out => l_msg_index_out);
392 x_msg_data := l_data;
393 x_msg_count := l_msg_count;
394 ELSE
395 x_msg_count := l_msg_count;
396 END IF;
397
398 IF l_debug_mode = 'Y' THEN
399 pa_debug.reset_curr_function;
400 END IF;
401
402 RAISE NO_DATA_FOUND;
403
404 WHEN others THEN
405
406 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
407 x_msg_count := 1;
408 x_msg_data := SQLERRM;
409
410 FND_MSG_PUB.add_exc_msg
411 ( p_pkg_name => 'PA_FP_SPREAD_CURVES_PKG'
412 ,p_procedure_name => 'UPDATE_ROW'
413 ,p_error_text => x_msg_data);
414
415 IF l_debug_mode = 'Y' THEN
416 pa_debug.g_err_stage:= 'Unexpected Error'||x_msg_data;
417 pa_debug.write(g_module_name,pa_debug.g_err_stage,
418 pa_fp_constants_pkg.g_debug_level5);
419 pa_debug.reset_curr_function;
420 END IF;
421
422 RAISE;
423 END Update_Row;
424
425 Procedure Load_Row (
426 X_Spread_Curve_Id IN Pa_Spread_Curves_B.Spread_Curve_Id%Type,
427 X_Spread_Curve_Code IN Pa_Spread_Curves_B.Spread_Curve_Code%Type,
428 X_Record_Version_Number IN Pa_Spread_Curves_B.Record_Version_Number%Type,
429 X_Name IN Pa_Spread_Curves_Tl.Name%Type,
430 X_Description IN Pa_Spread_Curves_Tl.Description%Type,
431 X_Effective_Start_Date IN Pa_Spread_Curves_B.Effective_Start_Date%Type,
432 X_Effective_End_Date IN Pa_Spread_Curves_B.Effective_End_Date%Type,
433 X_Rounding_Factor_Code IN Pa_Spread_Curves_B.Rounding_Factor_Code%Type,
434 X_Point1 IN Pa_Spread_Curves_B.Point1%Type,
435 X_Point2 IN Pa_Spread_Curves_B.Point2%Type,
436 X_Point3 IN Pa_Spread_Curves_B.Point3%Type,
437 X_Point4 IN Pa_Spread_Curves_B.Point4%Type,
438 X_Point5 IN Pa_Spread_Curves_B.Point5%Type,
439 X_Point6 IN Pa_Spread_Curves_B.Point6%Type,
440 X_Point7 IN Pa_Spread_Curves_B.Point7%Type,
441 X_Point8 IN Pa_Spread_Curves_B.Point8%Type,
442 X_Point9 IN Pa_Spread_Curves_B.Point9%Type,
443 X_Point10 IN Pa_Spread_Curves_B.Point10%Type,
444 X_Owner IN Varchar2
445 )
446 IS
447
448 User_Id NUMBER := Null;
449 X_ROWID VARCHAR2(64);
450 l_return_status VARCHAR2(1) := NULL;
451 l_msg_count NUMBER := 0;
452 l_data VARCHAR2(2000) := NULL;
453 l_msg_data VARCHAR2(2000) := NULL;
454 l_msg_index_out NUMBER;
455 l_debug_mode VARCHAR2(1) := Null;
456
457 BEGIN
458
459 IF (X_Owner = 'SEED')THEN
460 User_Id := 1;
461 ELSE
462 User_Id := 0;
463 END IF;
464 Pa_Fp_Spread_Curves_Pkg.Update_Row (
465 X_Spread_Curve_Id => X_Spread_Curve_Id ,
466 X_Spread_Curve_Code => X_Spread_Curve_Code ,
467 X_Record_Version_Number => X_Record_Version_Number ,
468 X_Name => X_Name ,
469 X_Description => X_Description ,
470 X_Effective_Start_Date => X_Effective_Start_Date ,
471 X_Effective_End_Date => X_Effective_End_Date ,
472 X_Rounding_Factor_Code => X_Rounding_Factor_Code ,
473 X_Point1 => X_Point1 ,
474 X_Point2 => X_Point2 ,
475 X_Point3 => X_Point3 ,
476 X_Point4 => X_Point4 ,
477 X_Point5 => X_Point5 ,
478 X_Point6 => X_Point6 ,
479 X_Point7 => X_Point7 ,
480 X_Point8 => X_Point8 ,
481 X_Point9 => X_Point9 ,
482 X_Point10 => X_Point10 ,
483 X_Last_Update_Date => Sysdate ,
484 X_Last_Updated_By => User_Id ,
485 X_Last_Update_Login => 0 ,
486 X_Return_Status => l_Return_Status ,
487 X_Msg_Data => l_Msg_Data ,
488 X_Msg_Count => l_Msg_Count );
489
490
491 EXCEPTION
492 WHEN no_data_found then
493
494 Pa_Fp_Spread_Curves_Pkg.Insert_Row (
495 X_Rowid => X_Rowid ,
496 X_Spread_Curve_Id => X_Spread_Curve_Id ,
497 X_Spread_Curve_Code => X_Spread_Curve_Code ,
498 X_Record_Version_Number => X_Record_Version_Number ,
499 X_Name => X_Name ,
500 X_Description => X_Description ,
501 X_Effective_Start_Date => X_Effective_Start_Date ,
502 X_Effective_End_Date => X_Effective_End_Date ,
503 X_Rounding_Factor_Code => X_Rounding_Factor_Code ,
504 X_Point1 => X_Point1 ,
505 X_Point2 => X_Point2 ,
506 X_Point3 => X_Point3 ,
507 X_Point4 => X_Point4 ,
508 X_Point5 => X_Point5 ,
509 X_Point6 => X_Point6 ,
510 X_Point7 => X_Point7 ,
511 X_Point8 => X_Point8 ,
512 X_Point9 => X_Point9 ,
513 X_Point10 => X_Point10 ,
514 X_Creation_Date => Sysdate ,
515 X_Created_By => User_Id ,
516 X_Last_Update_Date => Sysdate ,
517 X_Last_Updated_By => User_Id ,
518 X_Last_Update_Login => 0 ,
519 X_Return_Status => l_Return_Status ,
520 X_Msg_Data => l_Msg_Data ,
521 X_Msg_Count => l_Msg_Count );
522
523 WHEN others THEN
524
525 l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
526 l_msg_count := 1;
527 l_msg_data := SQLERRM;
528
529 FND_MSG_PUB.add_exc_msg
530 ( p_pkg_name => 'PA_FP_SPREAD_CURVES_PKG'
531 ,p_procedure_name => 'UPDATE_ROW'
532 ,p_error_text => l_msg_data);
533
534 IF l_debug_mode = 'Y' THEN
535 pa_debug.g_err_stage:= 'Unexpected Error'||l_msg_data;
536 pa_debug.write(g_module_name,pa_debug.g_err_stage,
537 pa_fp_constants_pkg.g_debug_level5);
538 pa_debug.reset_curr_function;
539 END IF;
540
541 RAISE;
542 END Load_Row;
543
544
545 PROCEDURE Add_Language
546 IS
547 BEGIN
548
549 delete from PA_SPREAD_CURVES_TL T
550 where not exists
551 (select NULL
552 from PA_SPREAD_CURVES_B B
553 where B.SPREAD_CURVE_ID = T.SPREAD_CURVE_ID
554 );
555
556 update PA_SPREAD_CURVES_TL T set (
557 NAME,
558 DESCRIPTION
559 ) = (select
560 B.NAME,
561 B.DESCRIPTION
562 from PA_SPREAD_CURVES_TL B
563 where B.SPREAD_CURVE_ID = T.SPREAD_CURVE_ID
564 and B.LANGUAGE = T.SOURCE_LANG)
565 where (
566 T.SPREAD_CURVE_ID,
567 T.LANGUAGE
568 ) in (select
569 SUBT.SPREAD_CURVE_ID,
570 SUBT.LANGUAGE
571 from PA_SPREAD_CURVES_TL SUBB, PA_SPREAD_CURVES_TL SUBT
572 where SUBB.SPREAD_CURVE_ID = SUBT.SPREAD_CURVE_ID
573 and SUBB.LANGUAGE = SUBT.SOURCE_LANG
574 and (SUBB.NAME <> SUBT.NAME
575 or SUBB.DESCRIPTION <> SUBT.DESCRIPTION
576 or (SUBB.DESCRIPTION is null and SUBT.DESCRIPTION is not null)
577 or (SUBB.DESCRIPTION is not null and SUBT.DESCRIPTION is null)
578 ));
579
580 insert into PA_SPREAD_CURVES_TL (
581 LAST_UPDATE_LOGIN,
582 CREATION_DATE,
583 CREATED_BY,
584 LAST_UPDATE_DATE,
585 LAST_UPDATED_BY,
586 SPREAD_CURVE_ID,
587 NAME,
588 DESCRIPTION,
589 LANGUAGE,
590 SOURCE_LANG
591 )select
592 B.LAST_UPDATE_LOGIN,
593 B.CREATION_DATE,
594 B.CREATED_BY,
595 B.LAST_UPDATE_DATE,
596 B.LAST_UPDATED_BY,
597 B.SPREAD_CURVE_ID,
598 B.NAME,
599 B.DESCRIPTION,
600 L.LANGUAGE_CODE,
601 B.SOURCE_LANG
602 from PA_SPREAD_CURVES_TL B, FND_LANGUAGES L
603 where L.INSTALLED_FLAG in ('I', 'B')
604 and B.LANGUAGE = userenv('LANG')
605 and not exists
606 (select NULL
607 from PA_SPREAD_CURVES_TL T
608 where T.SPREAD_CURVE_ID = B.SPREAD_CURVE_ID
609 and T.LANGUAGE = L.LANGUAGE_CODE);
610 end ADD_LANGUAGE;
611
612
613 procedure TRANSLATE_ROW (
614 X_SPREAD_CURVE_ID in PA_SPREAD_CURVES_B.SPREAD_CURVE_ID%TYPE,
615 X_OWNER in VARCHAR2 ,
616 X_NAME in PA_SPREAD_CURVES_TL.NAME%TYPE,
617 X_DESCRIPTION in PA_SPREAD_CURVES_TL.DESCRIPTION%TYPE
618 )is
619 begin
620
621 update PA_SPREAD_CURVES_TL set
622 NAME = X_NAME,
623 DESCRIPTION = X_DESCRIPTION,
624 LAST_UPDATE_DATE = sysdate,
625 LAST_UPDATED_BY = decode(X_OWNER, 'SEED', 1, 0),
626 LAST_UPDATE_LOGIN = 0,
627 SOURCE_LANG = userenv('LANG')
628 where SPREAD_CURVE_ID = X_SPREAD_CURVE_ID
629 and userenv('LANG') in (LANGUAGE, SOURCE_LANG) ;
630
631 if (sql%notfound) then
632 raise no_data_found;
633 end if;
634
635 end TRANSLATE_ROW;
636
637
638 end PA_FP_SPREAD_CURVES_PKG;