DBA Data[Home] [Help]

PACKAGE BODY: APPS.XLE_JURISDICTIONS_F_PKG

Source


1 PACKAGE BODY xle_jurisdictions_f_pkg AS
2 /* $Header: xlejurib.pls 120.7 2005/10/06 20:14:23 achiroma ship $ */
3 /*======================================================================+
4 |             Copyright (c) 2001-2002 Oracle Corporation                |
5 |                       Redwood Shores, CA, USA                         |
6 |                         All rights reserved.                          |
7 +=======================================================================+
8 | PACKAGE NAME                                                          |
9 |    xle_jurisdictions                                                  |
10 |                                                                       |
11 | DESCRIPTION                                                           |
12 |    Forms PL/SQL Wrapper for xle_jurisdictions                         |
13 |                                                                       |
14 |                                                                       |
15 +======================================================================*/
16 
17 
18 /*======================================================================+
19 |                                                                       |
20 |  Procedure add_language                                               |
21 |                                                                       |
22 +======================================================================*/
23 PROCEDURE add_language
24 
25 IS
26 
27 BEGIN
28 
29 DELETE FROM xle_jurisdictions_tl T
30 WHERE  NOT EXISTS
31       (SELECT NULL
32        FROM   xle_jurisdictions_b                b
33        WHERE  b.jurisdiction_id                  = t.jurisdiction_id);
34 
35 
36 UPDATE xle_jurisdictions_tl   t
37 SET   (name)
38    = (SELECT b.name
39       FROM   xle_jurisdictions_tl               b
40       WHERE  b.jurisdiction_id                  = t.jurisdiction_id
41         AND  b.language                         = t.source_lang)
42 WHERE (t.jurisdiction_id
43       ,t.language)
44     IN (SELECT subt.jurisdiction_id
45               ,subt.language
46         FROM   xle_jurisdictions_tl                   subb
47               ,xle_jurisdictions_tl                   subt
48         WHERE  subb.jurisdiction_id                  = subt.jurisdiction_id
49          AND  subb.language                         = subt.source_lang
50          AND (SUBB.name                             <> SUBT.name
51       ))
52 ;
53 
54 INSERT INTO xle_jurisdictions_tl
55 (jurisdiction_id
56 ,name
57 ,last_updated_by
58 ,creation_date
59 ,last_update_login
60 ,last_update_date
61 ,created_by
62 ,language
63 ,source_lang)
64 SELECT   /*+ ORDERED */
65        b.jurisdiction_id
66       ,b.name
67       ,b.last_updated_by
68       ,b.creation_date
69       ,b.last_update_login
70       ,b.last_update_date
71       ,b.created_by
72       ,l.language_code
73       ,b.source_lang
74 FROM   xle_jurisdictions_tl             b
75       ,fnd_languages                    l
76 WHERE  l.installed_flag                IN ('I', 'B')
77   AND  b.language                       = userenv('LANG')
78   AND  NOT EXISTS
79       (SELECT NULL
80        FROM   xle_jurisdictions_tl               t
81        WHERE  t.jurisdiction_id                  = b.jurisdiction_id
82          AND  t.language                         = l.language_code);
83 
84 
85 END add_language;
86 
87 end xle_jurisdictions_f_PKG;