DBA Data[Home] [Help]

PACKAGE: SYS.UTL_GDK

Source


1 PACKAGE utl_gdk AS
2 
3   /* GDK (Globalization Developer's Kit) is a set of services that can help
4    * monolingual application developer to create similar multilingual
5    * application with minimal knowledge about internationalization issues.
6    * GDK includes two major components, internet globalization services and
7    * Oracle globalization services. Internet global services can hide the
8    * complexity of globalization to support multi-user with different locale.
9    * Oracle globalization services provide developer a set of consistent,
10    * high performance and easy to use tools in middle-tier as database client.
11    */
12 
13   /* Miscellaneous flags used by the locale-mapping API */
14   ORACLE_TO_IANA    CONSTANT PLS_INTEGER := 1;
15   IANA_TO_ORACLE    CONSTANT PLS_INTEGER := 2;
16   ORACLE_TO_ISO     CONSTANT PLS_INTEGER := 3;
17   ISO_TO_ORACLE     CONSTANT PLS_INTEGER := 4;
18   ORACLE_TO_ISO_A3  CONSTANT PLS_INTEGER := 5;
19   ISO_A3_TO_ORACLE  CONSTANT PLS_INTEGER := 6;
20 
21   /**
22    * Map ORACLE character set name to IANA name and vice versa. For example,
23    * utl_gdk.charset_map('iso-8859-p1', utl_gdk.IANA_TO_ORACLE) will return
24    * 'WE8ISO8859P1'. If user inputs an invalid character set or invalid flag
25    * name, an empty string will be returned. If user does not specify the
26    * flag, we will use "ORACLE_TO_IANA" as the default flag. For example,
27    * if user does not specify the conversion direction, we will always assume
28    * that the current string uses Oracle standard.
29    *
30    * PARAMETERS
31    *   charset   The character set name to map. The mapping is
32    *             case-insensitive.
33    *   flag      ORACLE_TO_IANA - map from ORACLE name to IANA name.
34    *             IANA_TO_ORACLE - map from IANA name to ORACLE name.
35    * RETURN
36    *   The mapped character set name if a match is found. NULL if no match
37    *   is found or the flag is invalid.
38    * EXCEPTIONS
39    *   miscellaneous runtime exceptions.
40    */
41   FUNCTION charset_map(charset IN VARCHAR2,
42                        flag    IN PLS_INTEGER DEFAULT ORACLE_TO_IANA)
43                        RETURN VARCHAR2;
44 
45   /**
46    * Map between ORACLE language name and ISO language name. For example,
47    * utl_gdk.language_map('english', utl_gdk.ORACLE_TO_ISO) will return "en".
48    * If user input is invalid, a null string will be returned. If user does
49    * not give any flag, ORACLE_TO_ISO will be the default flag.
50    *
51    * PARAMETERS
52    *   language  The language name to map. The mapping is case-insensitive.
53    *   flag      ORACLE_TO_ISO - map from ORACLE name to ISO name.
54    *             ISO_TO_ORACLE - map from ISO name to ORACLE name.
55    * RETURN
56    *   The mapped language name if a match is found. NULL if no match
57    *   is found or the flag is invalid.
58    * EXCEPTIONS
59    *   miscellaneous runtime exceptions.
60    */
61   FUNCTION language_map(language IN VARCHAR2,
62                         flag     IN PLS_INTEGER DEFAULT ORACLE_TO_ISO)
63                         RETURN VARCHAR2;
64 
65   /**
66    * Map between ORACLE territory name and ISO A-2 or A-3 territory name.
67    * The difference of ISO A-2 and A-3 is that the later uses 3 characters to
68    * represent a territory instead of 2 characters. For example,
69    * utl_gdk.territory_map('US', utl_gdk.ISO_TO_ORACLE) will return "America"
70    * and utl_gdk.territory_map('usa', ISO_A3_TO_ORACLE) will return "America"
71    * as well. If user input is invalid, a null string will be returned.
72    * If user does not give any flag, ORACLE_TO_ISO will be the default flag.
73    *
74    * PARAMETERS
75    *   territory The territory name to map. The mapping is case-insensitive.
76    *   flag      ORACLE_TO_ISO    - map from ORACLE name to ISO A-2 name.
77    *             ISO_TO_ORACLE    - map from ISO A-2 name to ORACLE name.
78    *             ORACLE_TO_ISO_A3 - map from ORACLE name to ISO A-3 name.
79    *             ISO_A3_TO_ORACLE - map from ISO A-3 name to ORACLE name.
80    * RETURN
81    *   The mapped territory name if a match is found. NULL if no match
82    *   is found or the flag is invalid.
83    * EXCEPTIONS
84    *   miscellaneous runtime exceptions.
85    */
86   FUNCTION territory_map(territory IN VARCHAR2,
87                          flag      IN PLS_INTEGER DEFAULT ORACLE_TO_ISO)
88                          RETURN VARCHAR2;
89 
90 END utl_gdk;