The OracleGlobalization
class is used to obtain and set the Oracle globalization settings of the session, thread, and local computer (read-only).
Class Inheritance
System.Object
Oracle.DataAccess.Client.OracleGlobalization
public sealed class OracleGlobalization : ICloneable, IDisposable
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
An exception is thrown for invalid property values. All newly set property values are validated, except the TimeZone
property.
Changing the OracleGlobalization
object properties does not change the globalization settings of the session or the thread. Either the SetSessionInfo
method of the OracleConnection
object or the SetThreadInfo
method of the OracleGlobalization
object must be called to alter the session's and thread's globalization settings, respectively.
// C# using System; using Oracle.DataAccess.Client; class OracleGlobalizationSample { static void Main() { // Get thread's globalization info OracleGlobalization glob = OracleGlobalization.GetThreadInfo(); // Prints "glob.Language = AMERICAN" Console.WriteLine("glob.Language = " + glob.Language); // Set language on thread's globalization info glob.Language = "FRENCH"; OracleGlobalization.SetThreadInfo(glob); OracleGlobalization.GetThreadInfo(glob); // Prints "glob.Language = FRENCH" Console.WriteLine("glob.Language = " + glob.Language); glob.Dispose(); } }
Namespace: Oracle.DataAccess.Client
Assembly: Oracle.DataAccess.dll
ODP.NET Version: ODP.NET for .NET Framework 2.0 or ODP.NET for .NET Framework 4
See Also:
OracleGlobalization
members are listed in the following tables.
OracleGlobalization Static Methods
The OracleGlobalization
static methods are listed in Table 10-1.
Table 10-1 OracleGlobalization Static Methods
Name | Description |
---|---|
Returns an |
|
Returns or refreshes an |
|
Sets Oracle globalization parameters to the current thread |
OracleGlobalization Properties
The OracleGlobalization
properties are listed in Table 10-2.
Table 10-2 OracleGlobalization Properties
Name | Description |
---|---|
Specifies the calendar system |
|
Specifies a client character set |
|
Specifies a method of comparison for |
|
Specifies the string to use as a local currency symbol for the L number format element |
|
Specifies the date format for Oracle |
|
Specifies the language used to spell day and month names and date abbreviations |
|
Specifies the dual currency symbol, such as Euro, for the U number format element |
|
Specifies the string to use as an international currency symbol for the C number format element |
|
Specifies the default language of the database |
|
Enables creation of |
|
Determines whether or not data loss during an implicit or explicit character type conversion reports an error |
|
Specifies the characters used for the decimal character and the group separator character for numeric values in strings |
|
Specifies the collating sequence for |
|
Specifies the name of the territory |
|
Specifies the string format for |
|
Specifies the string format for |
|
Specifies the time zone region name |
OracleGlobalization Public Methods
OracleGlobalization
public methods are listed in Table 10-3.
The OracleGlobalization
static methods are listed in Table 10-4.
Table 10-4 OracleGlobalization Static Methods
Name | Description |
---|---|
Returns an |
|
Returns or refreshes an |
|
Sets Oracle globalization parameters to the current thread |
See Also:
GetClientInfo
returns an OracleGlobalization
object instance that represents the Oracle globalization settings of the local computer.
This method returns an OracleGlobalization
instance that represents the globalization settings of the local computer.
GetClientInfo(OracleGlobalization)
This method refreshes the provided OracleGlobalization
object with the globalization settings of the local computer.
This method returns an OracleGlobalization
instance that represents the globalization settings of the local computer.
// C# public static OracleGlobalization GetClientInfo();
An OracleGlobalization
instance.
// C# using System; using Oracle.DataAccess.Client; class GetClientInfoSample { static void Main() { // Get client's globalization info OracleGlobalization glob = OracleGlobalization.GetClientInfo(); // Prints "glob.Language = AMERICAN" Console.WriteLine("glob.Language = " + glob.Language); glob.Dispose(); } }
This method refreshes the provided OracleGlobalization
object with the globalization settings of the local computer.
// C#
public static void GetClientInfo(OracleGlobalization oraGlob);
oraGlob
The OracleGlobalization
object being updated.
// C# using System; using Oracle.DataAccess.Client; class GetClientInfoSample { static void Main() { // Get client's globalization info OracleGlobalization glob = OracleGlobalization.GetClientInfo(); // Prints "glob.Language = AMERICAN" Console.WriteLine("glob.Language = " + glob.Language); // Get client's globalization info using overload OracleGlobalization.GetClientInfo(glob); // Prints "glob.Language = AMERICAN" Console.WriteLine("glob.Language = " + glob.Language); glob.Dispose(); } }
GetThreadInfo
returns or refreshes an OracleGlobalization
instance.
This method returns an OracleGlobalization
object instance of the current thread.
GetThreadInfo(OracleGlobalization)
This method refreshes the OracleGlobalization
object instance with the globalization settings of the current thread.
This method returns an OracleGlobalization
instance of the current thread.
// C# public static OracleGlobalization GetThreadInfo();
An OracleGlobalization
instance.
Initially, GetThreadInfo()
returns an OracleGlobalization
object that has the same property values as that returned by GetClientInfo()
, unless the application changes it by invoking SetThreadInfo()
.
// C# using System; using Oracle.DataAccess.Client; class GetThreadInfoSample { static void Main() { // Get thread's globalization info OracleGlobalization glob = OracleGlobalization.GetThreadInfo(); // Prints "glob.Language = AMERICAN" Console.WriteLine("glob.Language = " + glob.Language); // Get thread's globalization info using overloaded OracleGlobalization.GetThreadInfo(glob); // Prints "glob.Language = AMERICAN" Console.WriteLine("glob.Language = " + glob.Language); glob.Dispose(); } }
This method refreshes the OracleGlobalization
object with the globalization settings of the current thread.
// C#
public static void GetThreadInfo(OracleGlobalization oraGlob);
oraGlob
The OracleGlobalization
object being updated.
Initially GetThreadInfo()
returns an OracleGlobalization
object that has the same property values as that returned by GetClientInfo()
, unless the application changes it by invoking SetThreadInfo()
.
// C# using System; using Oracle.DataAccess.Client; class GetThreadInfoSample { static void Main() { // Get thread's globalization info OracleGlobalization glob = OracleGlobalization.GetThreadInfo(); // Prints "glob.Language = AMERICAN" Console.WriteLine("glob.Language = " + glob.Language); // Get thread's globalization info using overloaded OracleGlobalization.GetThreadInfo(glob); // Prints "glob.Language = AMERICAN" Console.WriteLine("glob.Language = " + glob.Language); glob.Dispose(); } }
This method sets Oracle globalization parameters to the current thread.
// C#
public static void SetThreadInfo(OracleGlobalization oraGlob);
oraGlob
An OracleGlobalization
object.
Any .NET string conversions to and from ODP.NET Types, as well as ODP.NET Type constructors, use the globalization property values where applicable. For example, when constructing an OracleDate
structure from a .NET string, that string is expected to be in the format specified by the OracleGlobalization
.DateFormat
property of the thread.
// C# using System; using Oracle.DataAccess.Client; class SetThreadInfoSample { static void Main() { // Get thread's globalization info OracleGlobalization glob1 = OracleGlobalization.GetThreadInfo(); // Prints "glob1.Language = AMERICAN" Console.WriteLine("glob1.Language = " + glob1.Language); // Set language on thread's globalization info glob1.Language = "FRENCH"; OracleGlobalization.SetThreadInfo(glob1); OracleGlobalization glob2 = OracleGlobalization.GetThreadInfo(); // Prints "glob2.Language = FRENCH" Console.WriteLine("glob2.Language = " + glob2.Language); glob1.Dispose(); glob2.Dispose(); } }
The OracleGlobalization
properties are listed in Table 10-5.
Table 10-5 OracleGlobalization Properties
Name | Description |
---|---|
Specifies the calendar system |
|
Specifies a client character set |
|
Specifies a method of comparison for |
|
Specifies the string to use as a local currency symbol for the L number format element |
|
Specifies the date format for Oracle |
|
Specifies the language used to spell day and month names and date abbreviations |
|
Specifies the dual currency symbol, such as Euro, for the U number format element |
|
Specifies the string to use as an international currency symbol for the C number format element |
|
Specifies the default language of the database |
|
Enables creation of |
|
Determines whether or not data loss during an implicit or explicit character type conversion reports an error |
|
Specifies the characters used for the decimal character and the group separator character for numeric values in strings |
|
Specifies the collating sequence for |
|
Specifies the name of the territory |
|
Specifies the string format for |
|
Specifies the string format for |
|
Specifies the time zone region name |
See Also:
This property specifies the calendar system.
// C# public string Calendar {get; set;}
A string representing the Calendar
.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_CALENDAR
setting of the local computer. This value is the same regardless of whether or not the OracleGlobalization
object represents the settings of the client, thread, or session.
This property specifies a client character set.
// C# public string ClientCharacterSet {get;}
A string that the provides the name of the character set of the local computer.
The default value is the character set of the local computer.
This property represents a method of comparison for WHERE
clauses and comparison in PL/SQL blocks.
// C# public string Comparison {get; set;}
A string that provides the name of the method of comparison.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_COMP
setting of the local computer.
This property specifies the string to use as a local currency symbol for the L number format element.
// C# public string Currency {get; set;}
The string to use as a local currency symbol for the L number format element.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_CURRENCY
setting of the local computer.
See Also:
Oracle Database SQL Reference for further information on the L number format element
This property specifies the date format for Oracle Date
type as a string.
// C# public string DateFormat {get; set;}
The date format for Oracle Date
type as a string
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_DATE_FORMAT
setting of the local computer.
This property specifies the language used to spell names of days and months, and date abbreviations (for example: a.m., p.m., AD, BC).
// C# public string DateLanguage {get; set;}
A string specifying the language.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_DATE_LANGUAGE
setting of the local computer.
This property specifies the dual currency symbol, such as Euro, for the U number format element.
// C# public string DualCurrency {get; set;}
A string that provides the dual currency symbol.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_DUAL_CURRENCY
setting of the local computer.
See Also:
Oracle Database SQL Reference for further information on the U number format element
This property specifies the string to use as an international currency symbol for the C number format element.
// C# public string ISOCurrency {get; set;}
The string used as an international currency symbol.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_ISO_CURRENCY
setting of the local computer.
See Also:
Oracle Database SQL Reference for further information on the C number format element
This property specifies the default language of the database.
// C# public string Language {get; set;}
The default language of the database.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_LANGUAGE
setting of the local computer.
Language
is used for messages, day and month names, and sorting algorithms. It also determines NLS_DATE_LANGUAGE
and NLS_SORT
parameter values.
This property indicates whether or not CHAR
and VARCHAR2
columns use byte or character (default) length semantics.
// C# public string LengthSemantics {get; set;}
A string that indicates either byte or character length semantics.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_LENGTH_SEMANTICS
setting of the local computer.
This property determines whether or not data loss during an implicit or explicit character type conversion reports an error.
// C# public bool NCharConversionException {get; set;}
A string that indicates whether or not a character type conversion causes an error message.
ObjectDisposedException
- The object is already disposed.
The default value of NLS_NCHAR_CONV_EXCP
is False
, unless it is overridden by a setting in the INIT.ORA
file.
This property specifies the characters used for the decimal character and the group separator character for numeric values in strings.
// C# public string NumericCharacters {get; set;}
A string that represents the characters used.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_NUMERIC_CHARACTERS
setting of the local computer.
This property specifies the collating sequence for ORDER
by clause.
// C# public string Sort {get; set;}
A string that indicates the collating sequence.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_SORT
setting of the local computer.
This property specifies the name of the territory.
// C# public string Territory {get; set;}
A string that provides the name of the territory.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_TERRITORY
setting of the local computer.
Changing this property changes other globalization properties.
This property specifies the string format for TimeStamp
types.
// C# public string TimeStampFormat {get; set;}
The string format for TimeStamp
types.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_TIMESTAMP_FORMAT
setting of the local computer.
This property specifies the string format for TimeStampTZ
types.
// C# public string TimeStampTZFormat {get; set;}
The string format for TimeStampTZ
types.
ObjectDisposedException
- The object is already disposed.
The default value is the NLS_TIMESTAMP_TZ_FORMAT
setting of the local computer.
This property specifies the time zone region name or hour offset.
// C# public string TimeZone {get; set;}
The string represents the time zone region name or the time zone offset.
ObjectDisposedException
- The object is already disposed.
The default value is the time zone region name of the local computer
TimeZone
is only used when the thread constructs one of the TimeStamp
structures. TimeZone
has no effect on the session.
TimeZone
can be either an hour offset, for example, 7:00, or a valid time zone region name that is provided in V$TIMEZONE_NAMES
, such as US/Pacific. Time zone abbreviations are not supported.
Note:
PST is a time zone region name as well as a time zone abbreviation; therefore it is accepted byOracleGlobalization
.This property returns an empty string if the OracleGlobalization
object is obtained using GetSessionInfo()
or GetSessionInfo(OracleGlobalization)
. Initially, by default, the time zone of the session is identical to the time zone of the thread. Therefore, given that the session time zone is not changed by invoking ALTER
SESSION
calls, the session time zone can be fetched from the client's globalization settings.
OracleGlobalization
public methods are listed in Table 10-6.
Table 10-6 OracleGlobalization Public Methods
Public Method | Description |
---|---|
Creates a copy of an |
|
|
Inherited from |
See Also: