Skip Headers

Oracle® Data Provider for .NET Developer's Guide
10g Release 1 (10.1)

Part Number B10117-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

ODP.NET Type Structures

This section covers the ODP.NET Type structures.


OracleBinary Structure

The OracleBinary structure represents a variable-length stream of binary data to be stored in or retrieved from a database.


Class Inheritance

Object

  ValueType

    OracleBinary


Declaration
// C#
public struct OracleBinary : IComparable

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.


Example
// C#
// Concatenation of the OracleBinary values using + operator
OracleBinary ob1a = new OracleBinary(new byte[] {1,2,3});
OracleBinary ob1b = new OracleBinary(new byte[] {4});
OracleBinary ob1 = ob1a + ob1b;
OracleBinary ob2 = new OracleBinary(new byte[] {1,2,3,4});
// Output the length if ob1 is equal to ob2
if (ob1 == ob2)
    Console.WriteLine("The OracleBinary structures are equal with length " 
         + ob1.Length);


Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

OracleBinary Members

OracleBinary members are listed in the following tables:


OracleBinary Constructors

OracleBinary constructors are listed in Table 5-1

Table 5-1 OracleBinary Constructors

Constructor Description
OracleBinary Constructor Instantiates a new instance of OracleBinary structure


OracleBinary Static Fields

The OracleBinary static fields are listed in Table 5-2.

Table 5-2 OracleBinary Static Fields

Field Description
Null Represents a null value that can be assigned to an instance of the OracleBinary structure


OracleBinary Static Methods

The OracleBinary static methods are listed in Table 5-3.

Table 5-3 OracleBinary Static Methods

Methods Description
Concat Returns the concatenation of two OracleBinary structures
Equals Determines if two OracleBinary values are equal (Overloaded)
GreaterThan Determines if the first of two OracleBinary values is greater than the second
GreaterThanOrEqual Determines if the first of two OracleBinary values is greater than or equal to the second
LessThan Determines if the first of two OracleBinary values is less than the second
LessThanOrEqual Determines if the first of two OracleBinary values is less than or equal to the second
NotEquals Determines if two OracleBinary values are not equal


OracleBinary Static Operators

The OracleBinary static operators are listed in Table 5-4.

Table 5-4 OracleBinary Static Operators

Operator Description
operator + Concatenates two OracleBinary values
operator == Determines if two OracleBinary values are equal
operator > Determines if the first of two OracleBinary values is greater than the second
operator >= Determines if the first of two OracleBinary values is greater than or equal to the second
operator != Determines if two OracleBinary values are not equal
operator < Determines if the first of two OracleBinary value is less than the second
operator <= Determines if the first of two OracleBinary value is less than or equal to the second


OracleBinary Static Type Conversion Operators

The OracleBinary static type conversion operators are listed in Table 5-5.

Table 5-5 OracleBinary Static Type Conversion Operators

Operator Description
explicit operator byte[ ] Converts an instance value to a byte array
implicit operator OracleBinary Converts an instance value to an OracleBinary structure


OracleBinary Properties

The OracleBinary properties are listed in Table 5-6.

Table 5-6 OracleBinary Properties

Properties Description
IsNull Indicates whether the current instance has a null value
Item Obtains the particular byte in an OracleBinary structure using an index
Length Returns the length of the binary data
Value Returns the binary data that is stored in an OracleBinary structure


OracleBinary Instance Methods

The OracleBinary instance methods are listed in Table 5-7.

Table 5-7 OracleBinary Instance Methods

Methods Description
CompareTo Compares the current instance to an object and returns an integer that represents their relative values
Equals Determines if two objects contain the same binary data (Overloaded)
GetHashCode Returns a hash code for the current instance
GetType Inherited from Object
ToString Converts the current OracleBinary structure to a string

OracleBinary Constructor

The OracleBinary constructor instantiates a new instance of the OracleBinary structure and sets its value to the provided array of bytes.


Declaration
// C#
public OracleBinary(byte[ ] bytes); 

Parameters

OracleBinary Static Fields

The OracleBinary static fields are listed in Table 5-8.

Table 5-8 OracleBinary Static Fields

Field Description
Null Represents a null value that can be assigned to an instance of the OracleBinary structure


Null

This static field represents a null value that can be assigned to an instance of the OracleBinary structure.


Declaration
// C#
public static readonly OracleBinary Null;

OracleBinary Static Methods

The OracleBinary static methods are listed in Table 5-9.

Table 5-9 OracleBinary Static Methods

Methods Description
Concat Returns the concatenation of two OracleBinary structures
Equals Determines if two OracleBinary values are equal (Overloaded)
GreaterThan Determines if the first of two OracleBinary values is greater than the second
GreaterThanOrEqual Determines if the first of two OracleBinary values is greater than or equal to the second
LessThan Determines if the first of two OracleBinary values is less than the second
LessThanOrEqual Determines if the first of two OracleBinary values is less than or equal to the second
NotEquals Determines if two OracleBinary values are not equal


Concat

This method returns the concatenation of two OracleBinary structures.


Declaration
// C#
public static OracleBinary Concat(OracleBinary value1, OracleBinary value2);

Parameters

Return Value

An OracleBinary.


Remarks

If either argument has a null value, the returned OracleBinary structure has a null value.


Equals

This method determines if two OracleBinary values are equal.


Declaration
// C#
public static bool Equals(OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if two OracleBinary values are equal; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThan

This method determines whether the first of two OracleBinary values is greater than the second.


Declaration
// C#
public static bool GreaterThan(OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if the first of two OracleBinary values is greater than the second; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


Example
// C#
OracleBinary ob1 = OracleBinary.Null;
OracleBinary ob2 = new OracleBinary(new byte[] {1});
if (OracleBinary.GreaterThan(ob2,ob1))
  Console.WriteLine("ob2 > ob1");


GreaterThanOrEqual

This method determines whether the first of two OracleBinary values is greater than or equal to the second.


Declaration
// C#
public static bool GreaterThanOrEqual(OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if the first of two OracleBinary values is greater than or equal to the second; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


LessThan

This method determines whether the first of two OracleBinary values is less than the second.


Declaration
// C#
public static bool LessThan(OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if the first of two OracleBinary values is less than the second; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


LessThanOrEqual

This method determines whether the first of two OracleBinary values is less than or equal to the second.


Declaration
// C#
public static bool LessThanOrEqual(OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if the first of two OracleBinary values is less than or equal to the second; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


NotEquals

This method determines whether two OracleBinary values are not equal.


Declaration
// C#
public static bool NotEquals(OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if two OracleBinary values are not equal; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.

OracleBinary Static Operators

The OracleBinary static operators are listed in Table 5-10.

Table 5-10 OracleBinary Static Operators

Operator Description
operator + Concatenates two OracleBinary values
operator == Determines if two OracleBinary values are equal
operator > Determines if the first of two OracleBinary values is greater than the second
operator >= Determines if the first of two OracleBinary values is greater than or equal to the second
operator != Determines if two OracleBinary values are not equal
operator < Determines if the first of two OracleBinary value is less than the second
operator <= Determines if the first of two OracleBinary value is less than or equal to the second


operator +

This method concatenates two OracleBinary values.


Declaration
// C#
public static OracleBinary operator + (OracleBinary value1, OracleBinary value2);

Parameters

Return Value

OracleBinary


Remarks

If either argument has a null value, the returned OacleBinary structure has a null value.


operator ==

This method determines if two OracleBinary values are equal.


Declaration
// C#
public static bool operator == (OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if they are the same; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


operator >

This method determines if the first of two OracleBinary values is greater than the second.


Declaration
// C#
public static bool operator > (OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if the first of two OracleBinary values is greater than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


Example
// C#
OracleBinary ob1 = OracleBinary.Null;
OracleBinary ob2 = new OracleBinary(new byte[] {1});
if (ob2 > ob1)
  Console.WriteLine("ob2 > ob1");


operator >=

This method determines if the first of two OracleBinary values is greater than or equal to the second.


Declaration
// C#
public static bool operator >= (OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if the first of two OracleBinary values is greater than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator !=

This method determines if two OracleBinary values are not equal.


Declaration
// C#
public static bool operator != (OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if the two OracleBinary values are not equal; otherwise, returns false.


operator <

This method determines if the first of two OracleBinary values is less than the second.


Declaration
// C#
public static bool operator < ( OracleBinary value1, OracleBinary value2);

Parameters

Return Value

Returns true if the first of two OracleBinary values is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <=

This method determines if the first of two OracleBinary values is less than or equal to the second.


Declaration
// C#
public static bool operator <= (OracleBinary value1, OracleBinary value1);

Parameters

Return Value

Returns true if the first of two OracleBinary values is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.

OracleBinary Static Type Conversion Operators

The OracleBinary static type conversion operators are listed in Table 5-11.

Table 5-11 OracleBinary Static Type Conversion Operators

Operator Description
explicit operator byte[ ] Converts an instance value to a byte array
implicit operator OracleBinary Converts an instance value to an OracleBinary structure


explicit operator byte[ ]

This method converts an OracleBinary value to a byte array.


Declaration
// C#
public static explicit operator byte[ ] (OracleBinary val);

Parameters

Return Value

A byte array.


Exceptions

OracleNullValueException - The OracleBinary structure has a null value.


implicit operator OracleBinary

This method converts a byte array to an OracleBinary structure.


Declaration
// C#
public static implicit operator OracleBinary(byte[ ] bytes);

Parameters

Return Value

OracleBinary

OracleBinary Properties

The OracleBinary properties are listed in Table 5-12.

Table 5-12 OracleBinary Properties

Properties Description
IsNull Indicates whether the current instance has a null value
Item Obtains the particular byte in an OracleBinary structure using an index
Length Returns the length of the binary data
Value Returns the binary data that is stored in an OracleBinary structure


IsNull

This property indicates whether the current instance has a null value.


Declaration
// C#
public bool IsNull {get;}

Property Value

Returns true if the current instance has a null value; otherwise returns false.


Item

This property obtains the particular byte in an OracleBinary structure using an index.


Declaration
// C#
public byte this[int index] {get;}

Property Value

A byte in the specified index.


Exceptions

OracleNullValueException - The current instance has a null value.


Example
// C#
OracleBinary ob1 = new OracleBinary(new byte[] {4,3,2,1});
Console.WriteLine(ob1[ob1.Length-1]); // Prints the value 1


Length

This property returns the length of the binary data.


Declaration
// C#
public int length {get;}

Property Value

Length of the binary data.


Exceptions

OracleNullValueException - The current instance has a null value.


Example
// C#
OracleBinary ob1 = new OracleBinary(new byte[] {4,3,2,1});
Console.WriteLine(ob1.Length); // Prints the value 4


Value

This property returns the binary data that is stored in the OracleBinary structure.


Declaration
// C#
public byte[] Value {get;}

Property Value

Binary data.


Exceptions

OracleNullValueException - The current instance has a null value.

OracleBinary Instance Methods

The OracleBinary instance methods are listed in Table 5-13.

Table 5-13 OracleBinary Instance Methods

Methods Description
CompareTo Compares the current instance to an object and returns an integer that represents their relative values
Equals Determines if two objects contain the same binary data (Overloaded)
GetHashCode Returns a hash code for the current instance
GetType Inherited from Object
ToString Converts the current OracleBinary structure to a string


CompareTo

This method compares the current instance to an object and returns an integer that represents their relative values


Declaration
// C#
public int CompareTo(object obj);

Parameters

Return Value

The method returns a number that is:


Implements

IComparable


Exceptions

ArgumentException - The parameter is not of type OracleBinary.


Remarks

The following rules apply to the behavior of this method.


Example
// C#
OracleBinary ob1 = new OracleBinary(new byte[] {1,1,1,1});
OracleBinary ob2 = new OracleBinary(new byte[] {1});

// append to ob2 while they are not equal
while (ob1.CompareTo(ob2) != 0)
   ob2 = ob2 + ob2;
Console.WriteLine("ob1 == ob2");


Equals

This method determines whether an object is an instance of OracleBinary, and has the same binary data as the current instance.


Declaration
// C#
public override bool Equals(object obj);

Parameters

Return Value

Returns true if obj is an instance of OracleBinary, and has the same binary data as the current instance; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GetHashCode

Overrides Object

This method returns a hash code for the OracleBinary instance.


Declaration
// C#
public override int GetHashCode();

Return Value

An int that represents the hash.


ToString

Overrides Object

This method converts an OracleBinary instance to a string instance.


Declaration
// C#
public override string ToString();

Return Value

string


Remarks

If the current OracleBinary instance has a null value, the returned string "null".


OracleDate Structure

The OracleDate structure represents the Oracle DATE datatype to be stored in or retrieved from a database. Each OracleDate stores the following information: year, month, day, hour, minute, and second.


Class Inheritance

Object

  ValueType

    OracleDate


Declaration
// C#
public struct OracleDate : IComparable

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.


Example
// C#
// Compute the number of days between minimum values of
// the OracleDate and DateTime structures
OracleDate od1 = new OracleDate(DateTime.MinValue);
OracleDate od2 = OracleDate.MinValue;

// Set the nls_date_format for the ToString()
OracleGlobalization og = OracleGlobalization.GetClientInfo();
og.DateFormat = "DD-MON-YYYY BC";
OracleGlobalization.SetThreadInfo(og);

Console.WriteLine("DateTime.MinValue   = " + od1.ToString());
Console.WriteLine("OracleDate.MinValue = " + od2.ToString());

// Compare the two values
int result = od1.CompareTo(od2);

// Output the difference in number of days (as a positive value)
if (result == 0)
  Console.WriteLine("DateTime and OracleDate Minimum values"+
    " are equal.");
else if (result < 0)
  Console.WriteLine("DateTime Minimum value is before OracleDate" +
    " Minumum value by " + od2.GetDaysBetween(od1) + " days.");
else if (result > 0)
  Console.WriteLine("OracleDate Minimum value is before DateTime" +
    " Minumum value by " + od1.GetDaysBetween(od2) + " days.");


Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

OracleDate Members

OracleDate members are listed in the following tables:


OracleDate Constructors

OracleDate constructors are listed in Table 5-14

Table 5-14 OracleDate Constructors

Constructor Description
OracleDate Constructors Instantiates a new instance of OracleDate structure (Overloaded)


OracleDate Static Fields

The OracleDate static fields are listed in Table 5-15.

Table 5-15 OracleDate Static Fields

Field Description
MaxValue Represents the maximum valid date for an OracleDate structure, which is December 31, 9999 23:59:59
MinValue Represents the minimum valid date for an OracleDate structure, which is January 1, -4712 0:0:0
Null Represents a null value that can be assigned to the value of an OracleDate structure instance


OracleDate Static Methods

The OracleDate static methods are listed in Table 5-16.

Table 5-16 OracleDate Static Methods

Methods Description
Equals Determines if two OracleDate values are equal (Overloaded)
GreaterThan Determines if the first of two OracleDate values is greater than the second
GreaterThanOrEqual Determines if the first of two OracleDate values is greater than or equal to the second
LessThan Determines if the first of two OracleDate values is less than the second
LessThanOrEqual Determines if the first of two OracleDate values is less than or equal to the second
NotEquals Determines if two OracleDate values are not equal
GetSysDate Returns an OracleDate structure that represents the current date and time
Parse Returns an OracleDate structure and sets its value using a string


OracleDate Static Operators

The OracleDate static operators are listed in Table 5-17.

Table 5-17 OracleDate Static Operators

Operator Description
operator == Determines if two OracleDate values are the same
operator > Determines if the first of two OracleDate values is greater than the second
operator >= Determines if the first of two OracleDate values is greater than or equal to the second
operator != Determines if the two OracleDate values are not equal
operator < Determines if the first of two OracleDate values is less than the second
operator <= Determines if the first of two OracleDate values is less than or equal to the second


OracleDate Static Type Conversions

The OracleDate static type conversions are listed in Table 5-18.

Table 5-18 OracleDate Static Type Conversions

Operator Description
explicit operator DateTime Converts a structure to a DateTime structure
explicit operator OracleDate Converts a structure to an OracleDate structure (Overloaded)


OracleDate Properties

The OracleDate properties are listed in Table 5-19.

Table 5-19 OracleDate Properties

Properties Description
BinData Gets an array of bytes that represents an Oracle DATE in Oracle internal format
Day Gets the day component of an OracleDate method
IsNull Indicates whether the current instance has a null value
Hour Gets the hour component of an OracleDate
Minute Gets the minute component of an OracleDate
Month Gets the month component of an OracleDate
Second Gets the second component of an OracleDate
Value Gets the date and time that is stored in the OracleDate structure
Year Gets the year component of an OracleDate


OracleDate Methods

The OracleDate methods are listed in Table 5-20.

Table 5-20 OracleDate Methods

Methods Description
CompareTo Compares the current OracleDate instance to an object, and returns an integer that represents their relative values
Equals Determines whether an object has the same date and time as the current OracleDate instance (Overloaded)
GetHashCode Returns a hash code for the OracleDate instance
GetDaysBetween Calculates the number of days between the current OracleDate instance and an OracleDate structure
GetType Inherited from Object
ToOracleTimeStamp Converts the current OracleDate structure to an OracleTimeStamp structure
ToString Converts the current OracleDate structure to a string

OracleDate Constructors

The OracleDate constructors instantiates a new instance of the OracleDate structure.


Overload List:

OracleDate(DateTime)

This constructor creates a new instance of the OracleDate structure and sets its value for date and time using the supplied DateTime value.


Declaration
// C#
public OracleDate (DateTime dt);

Parameters

Remarks

The OracleDate structure only supports up to a second precision. The time value in the provided DateTime structure that has a precision smaller than second is ignored.


OracleDate(string)

This constructor creates a new instance of the OracleDate structure and sets its value using the supplied string.


Declaration
// C#
public OracleDate (string dateStr);

Parameters

Exceptions

ArgumentException - The dateStr is an invalid string representation of an Oracle DATE or the dateStr is not in the date format specified by the thread's OracleGlobalization.DateFormat property, which represents Oracle's NLS_DATE_FORMAT parameter.

ArgumentNullException - The dateStr is null.


Remarks

The names and abbreviations used for months and days are in the language specified by the DateLanguage and Calendar properties of the thread's OracleGlobalization object. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.


Example
// C#
// Set the nls_date_format for the Parse() method
OracleGlobalization og = OracleGlobalization.GetClientInfo();
og.DateFormat = "YYYY-MON-DD";
OracleGlobalization.SetThreadInfo(og);

// construct OracleDate from a string using the DateFormat specified.
OracleDate od = new OracleDate("1999-NOV-11");

// Set the nls_date_format for the OracleDate(string) constructor
og.DateFormat = "DD-MON-YYYY";
OracleGlobalization.SetThreadInfo(og);

Console.WriteLine(od.ToString()); // Prints 11-NOV-1999


OracleDate(int, int, int)

This constructor creates a new instance of the OracleDate structure and set its value for date using the supplied year, month, and day.


Declaration
// C#
public OracleDate (int year, int month, int day);

Parameters

Exceptions

ArgumentOutOfRangeException - The argument value for one or more of the parameters is out of the specified range.

ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleDate (that is, the day is out of range for the month).


OracleDate(int, int, int, int, int, int)

This constructor creates a new instance of the OracleDate structure and set its value for time using the supplied year, month, day, hour, minute, and second.


Declaration
// C#
public OracleDate (int year, int month, int day, int hour, int minute, int second);

Parameters

Exceptions

ArgumentOutOfRangeException - The argument value for one or more of the parameters is out of the specified range.

ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleDate (that is, the day is out of range for the month).


OracleDate(byte [ ])

This constructor creates a new instance of the OracleDate structure and sets its value to the provided byte array, which is in the internal Oracle DATE format.


Declaration
// C#
public OracleDate(byte [] bytes);

Parameters

Exceptions

ArgumentException - bytes is null or bytes is not in internal Oracle DATE format or bytes is not a valid Oracle DATE.

OracleDate Static Fields

The OracleDate static fields are listed in Table 5-21.

Table 5-21 OracleDate Static Fields

Field Description
MaxValue Represents the maximum valid date for an OracleDate structure, which is December 31, 9999 23:59:59
MinValue Represents the minimum valid date for an OracleDate structure, which is January 1, -4712 0:0:0
Null Represents a null value that can be assigned to the value of an OracleDate structure instance


MaxValue

This static field represents the maximum valid date for an OracleDate structure, which is December 31, 9999 23:59:59.


Declaration
// C#
public static readonly OracleDate MaxValue;

MinValue

This static field represents the minimum valid date for an OracleDate structure, which is January 1, -4712.


Declaration
// C#
public static readonly OracleDate MinValue;

Null

This static field represents a null value that can be assigned to the value of an OracleDate instance.


Declaration
// C#
public static readonly OracleDate Null;

OracleDate Static Methods

The OracleDate static methods are listed in Table 5-22.

Table 5-22 OracleDate Static Methods

Methods Description
Equals Determines if two OracleDate values are equal (Overloaded)
GreaterThan Determines if the first of two OracleDate values is greater than the second
GreaterThanOrEqual Determines if the first of two OracleDate values is greater than or equal to the second
LessThan Determines if the first of two OracleDate values is less than the second
LessThanOrEqual Determines if the first of two OracleDate values is less than or equal to the second
NotEquals Determines if two OracleDate values are not equal
GetSysDate Returns an OracleDate structure that represents the current date and time
Parse Returns an OracleDate structure and sets its value using a string


Equals

Overloads Object

This method determines if two OracleDate values are equal.


Declaration
// C#
public static bool Equals(OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if two OracleDate values are equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThan

This method determines if the first of two OracleDate values is greater than the second.


Declaration
// C#
public static bool GreaterThan(OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if the first of two OracleDate values is greater than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThanOrEqual

This method determines if the first of two OracleDate values is greater than or equal to the second.


Declaration
// C#
public static bool GreaterThanOrEqual(OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if the first of two OracleDate values is greater than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


LessThan

This method determines if the first of two OracleDate values is less than the second.


Declaration
// C#
public static bool LessThan(OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if the first of two OracleDate values is less than the second. Otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


LessThanOrEqual

This method determines if the first of two OracleDate values is less than or equal to the second.


Declaration
// C#
public static bool LessThanOrEqual(OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if the first of two OracleDate values is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


NotEquals

This method determines if two OracleDate values are not equal.


Declaration
// C#
public static bool NotEquals(OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if two OracleDate values are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GetSysDate

This method gets an OracleDate structure that represents the current date and time.


Declaration
// C#
public static OracleDate GetSysDate ();

Return Value

An OracleDate structure that represents the current date and time.


Parse

This method gets an OracleDate structure and sets its value for date and time using the supplied string.


Declaration
// C#
public static OracleDate Parse (string dateStr);

Parameters

Return Value

An OracleDate structure.


Exceptions

ArgumentException - The dateStr is an invalid string representation of an Oracle DATE or the dateStr is not in the date format specified by the thread's OracleGlobalization.DateFormat property, which represents Oracle's NLS_DATE_FORMAT parameter.

ArgumentNullException - The dateStr is null.


Remarks

The names and abbreviations used for months and days are in the language specified by the DateLanguage and Calendar properties of the thread's OracleGlobalization object. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.


Example
// C#
// Set the nls_date_format for the Parse() method
OracleGlobalization og = OracleGlobalization.GetClientInfo();
og.DateFormat = "YYYY-MON-DD";
OracleGlobalization.SetThreadInfo(og);

// construct OracleDate from a string using the DateFormat specified.
OracleDate od = OracleDate.Parse("1999-NOV-11");

// Set the nls_date_format for the ToString() method
og.DateFormat = "DD-MON-YYYY";
OracleGlobalization.SetThreadInfo(og);

Console.WriteLine(od.ToString()); // Prints 11-NOV-1999

OracleDate Static Operators

The OracleDate static operators are listed in Table 5-23.

Table 5-23 OracleDate Static Operators

Operator Description
operator == Determines if two OracleDate values are the same
operator > Determines if the first of two OracleDate values is greater than the second
operator >= Determines if the first of two OracleDate values is greater than or equal to the second
operator != Determines if the two OracleDate values are not equal
operator < Determines if the first of two OracleDate values is less than the second
operator <= Determines if the first of two OracleDate values is less than or equal to the second


operator ==

This method determines if two OracleDate values are the same.


Declaration
// C#
public static bool operator == (OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if they are the same; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator >

This method determines if the first of two OracleDate values is greater than the second.


Declaration
// C#
public static bool operator > (OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if the first of two OracleDate values is greater than the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.


operator >=

This method determines if the first of two OracleDate values is greater than or equal to the second.


Declaration
// C#
public static bool operator >= (OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if the first of two OracleDate values is greater than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator !=

This method determines if the two OracleDate values are not equal.


Declaration
// C#
public static bool operator != (OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if the two OracleDate values are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <

This method determines if the first of two OracleDate values is less than the second.


Declaration
// C#
public static bool operator < (OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if the first of two OracleDate values is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <=

This method determines if the first of two OracleDate values is less than or equal to the second.


Declaration
// C#
public static bool operator <= (OracleDate value1, OracleDate value2);

Parameters

Return Value

Returns true if the first of two OracleDate values is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.

OracleDate Static Type Conversions

The OracleDate static type conversions are listed in Table 5-24.

Table 5-24 OracleDate Static Type Conversions

Operator Description
explicit operator DateTime Converts a structure to a DateTime structure
explicit operator OracleDate Converts a structure to an OracleDate structure (Overloaded)


explicit operator DateTime

This method converts an OracleDate structure to a DateTime structure.


Declaration
// C#
public static explicit operator DateTime(OracleDate val);

Parameters

Return Value

A DateTime structure.

explicit operator OracleDate

explicit operator OracleDate converts the provided structure to a OracleDate structure.


Overload List:

explicit operator OracleDate(DateTime)

This method converts a DateTime structure to an OracleDate structure.


Declaration
// C#
public static explicit operator OracleDate(DateTime dt);

Parameters

Return Value

An OracleDate structure.


explicit operator OracleDate(OracleTimeStamp)

This method converts an OracleTimeStamp structure to an OracleDate structure.


Declaration
// C#
public explicit operator OracleDate(OracleTimeStamp ts);

Parameters

Return Value

The returned OracleDate structure contains the date and time in the OracleTimeStamp structure.


Remarks

The precision of the OracleTimeStamp value can be lost during the conversion.

If the OracleTimeStamp structure has a null value, the returned OracleDate structure also has a null value.


explicit operator OracleDate(string)

This method converts the supplied string to an OracleDate structure.


Declaration
// C#
public explicit operator OracleDate (string dateStr);

Parameters

Return Value

The returned OracleDate structure contains the date and time in the string dateStr.


Exceptions

ArgumentNullException - The dateStr is null.

ArgumentException - This exception is thrown if any of the following conditions exist:


Remarks

The names and abbreviations used for months and days are in the language specified by the DateLanguage and Calendar properties of the thread's OracleGlobalization object. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.


Example
// C#
// Set the nls_date_format for the Parse() method
OracleGlobalization og = OracleGlobalization.GetClientInfo();
og.DateFormat = "YYYY-MON-DD";
OracleGlobalization.SetThreadInfo(og);

// construct OracleDate from a string using the DateFormat specified.
OracleDate od = (OracleDate) "1999-NOV-11";

// Set the nls_date_format for the ToString() method
og.DateFormat = "DD-MON-YYYY";
OracleGlobalization.SetThreadInfo(og);

Console.WriteLine(od.ToString()); // Prints 11-NOV-1999

OracleDate Properties

The OracleDate properties are listed in Table 5-25.

Table 5-25 OracleDate Properties

Properties Description
BinData Gets an array of bytes that represents an Oracle DATE in Oracle internal format
Day Gets the day component of an OracleDate method
IsNull Indicates whether the current instance has a null value
Hour Gets the hour component of an OracleDate
Minute Gets the minute component of an OracleDate
Month Gets the month component of an OracleDate
Second Gets the second component of an OracleDate
Value Gets the date and time that is stored in the OracleDate structure
Year Gets the year component of an OracleDate


BinData

This property gets a array of bytes that represents an Oracle DATE in Oracle internal format.


Declaration
// C#
public byte[] BinData{get;}

Property Value

An array of bytes.


Exceptions

OracleNullValueException - OracleDate has a null value.


Day

This property gets the day component of an OracleDate.


Declaration
// C#
public int Day{get;}

Property Value

A number that represents the day. Range of Day is (1 to 31).


Exceptions

OracleNullValueException - OracleDate has a null value.


IsNull

This property indicates whether the current instance has a null value.


Declaration
// C#
public bool IsNull{get;}

Property Value

Returns true if the current instance has a null value; otherwise, returns false.


Hour

This property gets the hour component of an OracleDate.


Declaration
// C#
public int Hour {get;}

Property Value

A number that represents Hour. Range of Hour is (0 to 23).


Exceptions

OracleNullValueException - OracleDate has a null value.


Minute

This property gets the minute component of an OracleDate.


Declaration
// C#
public int Minute {get;}

Property Value

A number that represents Minute. Range of Minute is (0 to 59).


Exceptions

OracleNullValueException - OracleDate has a null value.


Month

This property gets the month component of an OracleDate.


Declaration
// C#
public int Month {get;}

Property Value

A number that represents Month. Range of Month is (1 to 12).


Exceptions

OracleNullValueException - OracleDate has a null value.


Second

This property gets the second component of an OracleDate.


Declaration
// C#
public int Second {get;}

Property Value

A number that represents Second. Range of Second is (0 to 59).


Exceptions

OracleNullValueException - OracleDate has a null value.


Value

This property specifies the date and time that is stored in the OracleDate structure.


Declaration
// C#
public DateTime Value {get;}

Property Value

A DateTime.


Exceptions

OracleNullValueException - OracleDate has a null value.


Year

This property gets the year component of an OracleDate.


Declaration
// C#
public int Year {get;}

Property Value

A number that represents Year. Range of Year is (-4712 to 9999).


Exceptions

OracleNullValueException - OracleDate has a null value.

OracleDate Methods

The OracleDate methods are listed in Table 5-26.

Table 5-26 OracleDate Methods

Methods Description
CompareTo Compares the current OracleDate instance to an object, and returns an integer that represents their relative values
Equals Determines whether an object has the same date and time as the current OracleDate instance (Overloaded)
GetHashCode Returns a hash code for the OracleDate instance
GetDaysBetween Calculates the number of days between the current OracleDate instance and an OracleDate structure
GetType Inherited from Object
ToOracleTimeStamp Converts the current OracleDate structure to an OracleTimeStamp structure
ToString Converts the current OracleDate structure to a string


CompareTo

This method compares the current OracleDate instance to an object, and returns an integer that represents their relative values.


Declaration
// C#
public int CompareTo(object obj);

Parameters

Return Value

The method returns:


Implements

IComparable


Exceptions

ArgumentException - The obj parameter is not an instance of OracleDate.


Remarks

The following rules apply to the behavior of this method.


Equals

This method determines whether an object has the same date and time as the current OracleDate instance.


Declaration
// C#
public override bool Equals( object obj);

Parameters

Return Value

Returns true if obj has the same type as the current instance and represents the same date and time; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


GetHashCode

Overrides Object

This method returns a hash code for the OracleDate instance.


Declaration
// C#
public override int GetHashCode();

Return Value

A number that represents the hash code.


GetDaysBetween

This method calculates the number of days between the current OracleDate instance and the supplied OracleDate structure.


Declaration
// C#
public int GetDaysBetween (OracleDate val);

Parameters

Return Value

The number of days between the current OracleDate instance and the OracleDate structure.


Exceptions

OracleNullValueException - The current instance or the supplied OracleDate structure has a null value.


ToOracleTimeStamp

This method converts the current OracleDate structure to an OracleTimeStamp structure.


Declaration
// C#
public OracleTimeStamp ToOracleTimeStamp();

Return Value

An OracleTimeStamp structure.


Remarks

The returned OracleTimeStamp structure has date and time in the current instance.

If the OracleDate instance has a null value, the returned OracleTimeStamp structure has a null value.


ToString

Overrides ValueType

This method converts the current OracleDate structure to a string.


Declaration
// C#
public override string ToString();

Return Value

A string.


Remarks

The returned value is a string representation of the OracleDate in the format specified by the thread's OracleGlobalization.DateFormat property. The names and abbreviations used for months and days are in the language specified by the thread's OracleGlobalization.DateLanguage and OracleGlobalization.Calendar properties. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.


Example
// C#
// Set the nls_date_format for the Parse() method
OracleGlobalization og = OracleGlobalization.GetClientInfo();
og.DateFormat = "YYYY-MON-DD";
OracleGlobalization.SetThreadInfo(og);

// construct OracleDate from a string using the DateFormat specified.
OracleDate od = new OracleDate("1999-NOV-11");

// Set the nls_date_format for the ToString() method
og.DateFormat = "DD-MON-YYYY";
OracleGlobalization.SetThreadInfo(og);

Console.WriteLine(od.ToString()); // Prints 11-NOV-1999



OracleDecimal Structure

The OracleDecimal structure represents an Oracle NUMBER in the database or any Oracle numeric value.


Class Inheritance

Object

  ValueType

    OracleDecimal


Declaration
// C#
public struct OracleDecimal : IComparable

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.


Remarks

OracleDecimal can store up to 38 precision, while the .NET Decimal datatype can only hold up to 28 precision. When accessing the OracleDecimal.Value property from an OracleDecimal that has a value greater than 28 precision, loss of precision can occur. To retrieve the actual value of OracleDecimal, use the OracleDecimal.ToString() method. Another approach is to obtain the OracleDecimal value as a byte array in an internal Oracle NUMBER format through the BinData property.


Example
// C#
// Illustrates the usage of OracleDecimal
OracleDecimal pi = OracleDecimal.Pi;
// Use of implicit operator OracleDecimal(int)
OracleDecimal approxPi = OracleDecimal.Divide(22,7);

// Round the difference to 5 decimal places
OracleDecimal diff=OracleDecimal.Round(OracleDecimal.Abs(pi -approxPi),5);

// Set the format for ToString() - display with trailing zeroes
diff.Format = "9.9999900";
Console.WriteLine(diff.ToString());


Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

OracleDecimal Members

OracleDecimal members are listed in the following tables:


OracleDecimal Constructors

OracleDecimal constructors are listed in Table 5-27

Table 5-27 OracleDecimal Constructors

Constructor Description
OracleDecimal Constructors Instantiates a new instance of OracleDecimal structure (Overloaded)


OracleDecimal Static Fields

The OracleDecimal static fields are listed in Table 5-28.

Table 5-28 OracleDecimal Static Fields

Field Description
MaxPrecision A constant representing the maximum precision, which is 38
MaxScale A constant representing the maximum scale, which is 127
MaxValue A constant representing the maximum value for this structure, which is 9.9…9 x 10125
MinScale A constant representing the minimum scale, which is -84
MinValue A constant representing the minimum value for this structure, which is -1.0 x 10130
NegativeOne A constant representing the negative one value
Null Represents a null value that can be assigned to an OracleDecimal instance
One A constant representing the positive one value
Pi A constant representing the numeric Pi value
Zero A constant representing the zero value


OracleDecimal Static (Comparison) Methods

The OracleDecimal static (comparison) methods are listed in Table 5-29.

Table 5-29 OracleDecimal Static (Comparison) Methods

Methods Description
Equals Determines if two OracleDecimal values are equal (Overloaded)
GreaterThan Determines if the first of two OracleDecimal values is greater than the second
GreaterThanOrEqual Determines if the first of two OracleDecimal values is greater than or equal to the second
LessThan Determines if the first of two OracleDecimal values is less than the second
LessThanOrEqual Determines if the first of two OracleDecimal values is less than or equal to the second.
NotEquals Determines if two OracleDecimal values are not equal


OracleDecimal Static (Manipulation) Methods

The OracleDecimal static (manipulation) methods are listed in Table 5-30.

Table 5-30 OracleDecimal Static (Manipulation) Methods

Methods Description
Abs Returns the absolute value of an OracleDecimal
Add Adds two OracleDecimal structures
AdjustScale Returns a new OracleDecimal with the specified number of digits and indicates whether or not to round or truncate the number if the scale is less than original
Ceiling Returns a new OracleDecimal structure with its value set to the ceiling of an OracleDecimal structure
ConvertToPrecScale Returns a new OracleDecimal structure with a new precision and scale
Divide Divides one OracleDecimal value by another
Floor Returns a new OracleDecimal structure with its value set to the floor of an OracleDecimal structure
Max Returns the maximum value of the two supplied OracleDecimal structures
Min Returns the minimum value of the two supplied OracleDecimal structures
Mod Returns a new OracleDecimal structure with its value set to the modulus of two OracleDecimal structures
Multiply Returns a new OracleDecimal structure with its value set to the result of multiplying two OracleDecimal structures
Negate Returns a new OracleDecimal structure with its value set to the negation of the supplied OracleDecimal structure
Parse Converts a string to an OracleDecimal
Round Returns a new OracleDecimal structure with its value set to that of the supplied OracleDecimal structure and rounded off to the specified place
SetPrecision Returns a new OracleDecimal structure with a new specified precision.
Shift Returns a new OracleDecimal structure with its value set to that of the supplied OracleDecimal structure, and its decimal place shifted to the specified number of places to the right
Sign Determines the sign of an OracleDecimal structure
Sqrt Returns a new OracleDecimal structure with its value set to the square root of the supplied OracleDecimal structure
Subtract Returns a new OracleDecimal structure with its value set to result of subtracting one OracleDecimal structure from another
Truncate Truncates the OracleDecimal at a specified position


OracleDecimal Static (Logarithmic) Methods

The OracleDecimal static (logarithmic) methods are listed in Table 5-31.

Table 5-31 OracleDecimal Static (Logarithmic) Methods

Methods Description
Exp Returns a new OracleDecimal structure with its value set to e raised to the supplied power
Log Returns the supplied OracleDecimal structure with its value set to the logarithm of the supplied OracleDecimal structure (Overloaded)
Pow Returns a new OracleDecimal structure with its value set to the supplied OracleDecimal structure raised to the supplied power (Overloaded)


OracleDecimal Static (Trigonometric) Methods

The OracleDecimal static (trigonometric) methods are listed in Table 5-32.

Table 5-32 OracleDecimal Static (Trigonometric) Methods

Methods Description
Acos Returns an angle in radian whose cosine is the supplied OracleDecimal structure
Asin Returns an angle in radian whose sine is the supplied OracleDecimal structure
Atan Returns an angle in radian whose tangent is the supplied OracleDecimal structure
Atan2 Returns an angle in radian whose tangent is the quotient of the two supplied OracleDecimal structures
Cos Returns the cosine of the supplied angle in radian
Sin Returns the sine of the supplied angle in radian
Tan Returns the tangent of the supplied angle in radian
Cosh Returns the hyperbolic cosine of the supplied angle in radian
Sinh Returns the hyperbolic sine of the supplied angle in radian
Tanh Returns the hyperbolic tangent of the supplied angle in radian


OracleDecimal Static (Comparison) Operators

The OracleDecimal static (comparison) operators are listed in Table 5-33.

Table 5-33 OracleDecimal Static (Comparison) Operators

Operator Description
operator + Adds two OracleDecimal values
operator / Divides one OracleDecimal value by another
operator == Determines if the two OracleDecimal values are equal
operator > Determines if the first of two OracleDecimal values is greater than the second
operator >= Determines if the first of two OracleDecimal values is greater than or equal to the second
operator != Determines if the two OracleDecimal values are not equal
operator < Determines if the first of two OracleDecimal values is less than the second
operator <= Determines if the first of two OracleDecimal values is less than or equal to the second
operator * Multiplies two OracleDecimal structures
operator - Subtracts one OracleDecimal structure from another
operator - Negates an OracleDecimal structure
operator% Returns a new OracleDecimal structure with its value set to the modulus of two OracleDecimal structures.


OracleDecimal Static Operators (Conversion from .NET Type to OracleDecimal)

The OracleDecimal static operators (Conversion from .NET Type to OracleDecimal) are listed in Table 5-34.

Table 5-34 OracleDecimal Static Operators (Conversion from .NET Type to OracleDecimal)

Operator Description
implicit operator OracleDecimal Converts an instance value to an OracleDecimal structure (Overloaded)
explicit operator OracleDecimal Converts an instance value to an OracleDecimal structure (Overloaded)


OracleDecimal Static Operators (Conversion from OracleDecimal to .NET)

The OracleDecimal static operators (Conversion from OracleDecimal to .NET) are listed in Table 5-35.

Table 5-35 OracleDecimal Static Operators (Conversion from OracleDecimal to .NET)

Operator Description
explicit operator byte Returns the byte representation of the OracleDecimal value
explicit operator decimal Returns the decimal representation of the OracleDecimal value
explicit operator double Returns the double representation of the OracleDecimal value
explicit operator short Returns the short representation of the OracleDecimal value
explicit operator int Returns the int representation of the OracleDecimal value
explicit operator long Returns the long representation of the OracleDecimal value
explicit operator float Returns the float representation of the OracleDecimal value


OracleDecimal Properties

The OracleDecimal properties are listed in Table 5-36.

Table 5-36 OracleDecimal Properties

Properties Description
BinData Returns a byte array that represents the Oracle NUMBER in Oracle internal format
Format Specifies the format for ToString()
IsInt Indicates whether the current instance is an integer
IsNull Indicates whether the current instance has a null value
IsPositive Indicates whether the current instance is greater than 0
IsZero Indicates whether the current instance has a zero value
Value Returns a decimal value


OracleDecimal Instance Methods

The OracleDecimal instance methods are listed in Table 5-37.

Table 5-37 OracleDecimal Instance Methods

Method Description
CompareTo Compares the current instance to the supplied object and returns an integer that represents their relative values
Equals Determines whether an object is an instance of OracleDecimal, and whether the value of the object is equal to the current instance (Overloaded)
GetHashCode Returns a hash code for the current instance
GetType Inherited from Object
ToByte Returns the byte representation of the current instance
ToDouble Returns the double representation of the current instance
ToInt16 Returns the Int16 representation of the current instance
ToInt32 Returns the Int32 representation of the current instance
ToInt64 Returns the Int64 representation of the current instance
ToSingle Returns the Single representation of the current instance
ToString Overloads Object.ToString()

Returns the string representation of the current instance


OracleDecimal Constructors

The OracleDecimal constructors instantiate a new instance of the OracleDecimal structure.


Overload List:

OracleDecimal(byte [ ])

This constructor creates a new instance of the OracleDecimal structure and sets its value to the supplied byte array, which is in an Oracle NUMBER format.


Declaration
// C#
public OracleDecimal(byte [] bytes);

Parameters

Exceptions

ArgumentException - The bytes parameter is not in a internal Oracle NUMBER format or bytes has an invalid value.

ArgumentNullException - The bytes parameter is null.


OracleDecimal(decimal)

This constructor creates a new instance of the OracleDecimal structure and sets its value to the supplied Decimal value.


Declaration
// C#
public OracleDecimal(decimal decX); 

Parameters

OracleDecimal(double)

This constructor creates a new instance of the OracleDecimal structure and sets its value to the supplied double value.


Declaration
// C#
public OracleDecimal(double doubleX)

Parameters

Exceptions

OverFlowException - The value of the supplied double is greater than the maximum value or less than the minimum value of OracleDecimal.


Remarks

OracleDecimal contains the following values depending on the provided double value:


OracleDecimal(int)

This constructor creates a new instance of the OracleDecimal structure and sets its value to the supplied Int32 value.


Declaration
// C#
public OracleDecimal(int intX);

Parameters

OracleDecimal(float)

This constructor creates a new instance of the OracleDecimal structure and sets its value to the supplied Single value.


Declaration
// C#
public OracleDecimal(float floatX);

Parameters

Remarks

OracleDecimal contains the following values depending on the provided float value:

float.PositiveInfinity: positive infinity value

float.NegativeInfinity: negative infinity value

float.NaN: null value


OracleDecimal(long)

This constructor creates a new instance of the OracleDecimal structure and sets its value to the supplied Int64 value.


Declaration
// C#
public OracleDecimal(long longX);

Parameters

OracleDecimal(string)

This constructor creates a new instance of the OracleDecimal structure and sets its value to the supplied string value.


Declaration
// C#
public OracleDecimal(string numStr);

Parameters

Exceptions

ArgumentException - The numStr parameter is an invalid string representation of an OracleDecimal.

ArgumentNullException - The numStr parameter is null.

OverFlowException - The value of numStr is greater than the maximum value or less than the minimum value of OracleDecimal.


OracleDecimal(string, string)

This constructor creates a new instance of the OracleDecimal structure with the supplied string value and number format.


Declaration
// C#
public OracleDecimal(string numStr, string format);

Parameters

Exceptions

ArgumentException - The numStr parameter is an invalid string representation of an OracleDecimal or the numStr is not in the numeric format specified by format.

ArgumentNullException - The numStr parameter is null.

OverFlowException - The value of numStr parameter is greater than the maximum value or less than the minimum value of OracleDecimal.


Remarks

If the numeric format includes decimal and group separators, then the provided string must use those characters defined by the OracleGlobalization.NumericCharacters of the thread.

If the numeric format includes the currency symbol, ISO currency symbol, or the dual currency symbol, then the provided string must use those symbols defined by the OracleGlobalization.Currency, OracleGlobalization.ISOCurrency, and OracleGlobalization.DualCurrency properties respectively.


Example
// C#
// Set the nls parameters to be used in the numeric format
OracleGlobalization og = OracleGlobalization.GetClientInfo();
og.Currency = "$";
og.NumericCharacters = ".,";
OracleGlobalization.SetThreadInfo(og);

// Construct an OracleDecimal using a valid numeric format
OracleDecimal od = new OracleDecimal("$2,222.22","L9G999D99");
Console.WriteLine(od.ToString()); // Prints $2,222.22

OracleDecimal Static Fields

The OracleDecimal static fields are listed in Table 5-38.

Table 5-38 OracleDecimal Static Fields

Field Description
MaxPrecision A constant representing the maximum precision, which is 38
MaxScale A constant representing the maximum scale, which is 127
MaxValue A constant representing the maximum value for this structure, which is 9.9…9 x 10125
MinScale A constant representing the minimum scale, which is -84
MinValue A constant representing the minimum value for this structure, which is -1.0 x 10130
NegativeOne A constant representing the negative one value
Null Represents a null value that can be assigned to an OracleDecimal instance
One A constant representing the positive one value
Pi A constant representing the numeric Pi value
Zero A constant representing the zero value


MaxPrecision

This static field represents the maximum precision, which is 38.


Declaration
// C#
public static readonly byte MaxPrecision;

MaxScale

This static field a constant representing the maximum scale, which is 127.


Declaration
// C#
public static readonly byte MaxScale;

MaxValue

This static field indicates a constant representing the maximum value for this structure, which is 9.9…9 x 10125 (38 nines followed by 88 zeroes).


Declaration
// C#
public static readonly OracleDecimal MaxValue;

MinScale

This static field indicates a constant representing the maximum scale, which is -84.


Declaration
// C#
public static readonly int MinScale;

MinValue

This static field indicates a constant representing the minimum value for this structure, which is -1.0 x 10130.


Declaration
// C#
public static readonly OracleDecimal MinValue;

NegativeOne

This static field indicates a constant representing the negative one value.


Declaration
// C#
public static readonly OracleDecimal NegativeOne;

Null

This static field represents a null value that can be assigned to an OracleDecimal instance.


Declaration
// C#
public static readonly OracleDecimal Null;

One

This static field indicates a constant representing the positive one value.


Declaration
// C#
public static readonly OracleDecimal One;

Pi

This static field indicates a constant representing the numeric Pi value.


Declaration
// C#
public static readonly OracleDecimal Pi;

Zero

This static field indicates a constant representing the zero value.


Declaration
// C#
public static readonly OracleDecimal Zero;

OracleDecimal Static (Comparison) Methods

The OracleDecimal static (comparison) methods are listed in Table 5-39.

Table 5-39 OracleDecimal Static (Comparison) Methods

Methods Description
Equals Determines if two OracleDecimal values are equal (Overloaded)
GreaterThan Determines if the first of two OracleDecimal values is greater than the second
GreaterThanOrEqual Determines if the first of two OracleDecimal values is greater than or equal to the second
LessThan Determines if the first of two OracleDecimal values is less than the second
LessThanOrEqual Determines if the first of two OracleDecimal values is less than or equal to the second.
NotEquals Determines if two OracleDecimal values are not equal


Equals

This method determines if two OracleDecimal values are equal.


Declaration
// C#
public static bool Equals(OracleDecimal value1, OracleDecimal value2);

Parameters

Return Value

Returns true if two OracleDecimal values are equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThan

This method determines if the first of two OracleDecimal values is greater than the second.


Declaration
// C#
public static bool GreaterThan(OracleDecimal value1, OracleDecimal value2);

Parameters

Return Value

Returns true if the first of two OracleDecimal values is greater than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThanOrEqual

This method determines if the first of two OracleDecimal values is greater than or equal to the second.


Declaration
// C#
public static bool GreaterThanOrEqual(OracleDecimal value1, OracleDecimal value2);

Parameters

Return Value

Returns true if the first of two OracleDecimal values is greater than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


LessThan

This method determines if the first of two OracleDecimal values is less than the second.


Declaration
// C#
public static bool LessThan(OracleDecimal value1, OracleDecimal value2);

Parameters

Return Value

Returns true if the first of two OracleDecimal values is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


LessThanOrEqual

This method determines if the first of two OracleDecimal values is less than or equal to the second.


Declaration
// C#
public static bool LessThanOrEqual(OracleDecimal value1, OracleDecimal value2);

Parameters

Return Value

Returns true if the first of two OracleDecimal values is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


NotEquals

This method determines if two OracleDecimal values are not equal.


Declaration
// C#
public static bool NotEquals(OracleDecimal value1, OracleDecimal value2);

Parameters

Return Value

Returns true if two OracleDecimal values are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.

OracleDecimal Static (Manipulation) Methods

The OracleDecimal static (manipulation) methods are listed in Table 5-40.

Table 5-40 OracleDecimal Static (Manipulation) Methods

Methods Description
Abs Returns the absolute value of an OracleDecimal
Add Adds two OracleDecimal structures
AdjustScale Returns a new OracleDecimal with the specified number of digits and indicates whether or not to round or truncate the number if the scale is less than original
Ceiling Returns a new OracleDecimal structure with its value set to the ceiling of an OracleDecimal structure
ConvertToPrecScale Returns a new OracleDecimal structure with a new precision and scale
Divide Divides one OracleDecimal value by another
Floor Returns a new OracleDecimal structure with its value set to the floor of an OracleDecimal structure
Max Returns the maximum value of the two supplied OracleDecimal structures
Min Returns the minimum value of the two supplied OracleDecimal structures
Mod Returns a new OracleDecimal structure with its value set to the modulus of two OracleDecimal structures
Multiply Returns a new OracleDecimal structure with its value set to the result of multiplying two OracleDecimal structures
Negate Returns a new OracleDecimal structure with its value set to the negation of the supplied OracleDecimal structure
Parse Converts a string to an OracleDecimal
Round Returns a new OracleDecimal structure with its value set to that of the supplied OracleDecimal structure and rounded off to the specified place
SetPrecision Returns a new OracleDecimal structure with a new specified precision.
Shift Returns a new OracleDecimal structure with its value set to that of the supplied OracleDecimal structure, and its decimal place shifted to the specified number of places to the right
Sign Determines the sign of an OracleDecimal structure
Sqrt Returns a new OracleDecimal structure with its value set to the square root of the supplied OracleDecimal structure
Subtract Returns a new OracleDecimal structure with its value set to result of subtracting one OracleDecimal structure from another
Truncate Truncates the OracleDecimal at a specified position


Abs

This method returns the absolute value of an OracleDecimal.


Declaration
// C#
public static OracleDecimal Abs(OracleDecimal val);

Parameters

Return Value

The absolute value of an OracleDecimal.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Add

This method adds two OracleDecimal structures.


Declaration
// C#
public static OracleDecimal Add(OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

Returns an OracleDecimal structure.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


AdjustScale

This method returns a new OracleDecimal with the specified number of digits and indicates whether or not to round or truncate the number if the scale is less than the original.


Declaration
// C#
public static OracleDecimal AdjustScale(OracleDecimal val, int digits,
     bool fRound);

Parameters

Return Value

An OracleDecimal.


Remarks

If the supplied OracleDecimal has a null value, the returned OracleDecimal has a null value.


Example
// C#
OracleDecimal od = new OracleDecimal(5.555); 
// Adjust Scale to 2 with rounding off
OracleDecimal odr = OracleDecimal.AdjustScale(od, 2, true);
Console.WriteLine(odr.ToString()); // Prints 5.56
// Adjust Scale to 2 with truncation
OracleDecimal odt = OracleDecimal.AdjustScale(od, 2, false);
Console.WriteLine(odt.ToString()); // Prints 5.55


Ceiling

This method returns a new OracleDecimal structure with its value set to the ceiling of the supplied OracleDecimal.


Declaration
// C#
public static OracleDecimal Ceiling(OracleDecimal val);

Parameters

Return Value

A new OracleDecimal structure.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


ConvertToPrecScale

This method returns a new OracleDecimal structure with a new precision and scale.


Declaration
// C#
public static OracleDecimal ConvertToPrecScale(OracleDecimal val, int precision, 
  int scale);

Parameters

Return Value

A new OracleDecimal structure.


Remarks

If the supplied OracleDecimal has a null value, the returned OracleDecimal has a null value.


Example
// C#
OracleDecimal od = new OracleDecimal(555.6666);

// Set the precision of od to 5 and scale to 2
OracleDecimal odp5s2 = OracleDecimal.ConvertToPrecScale(od,5,2);
Console.WriteLine(odp5s2.ToString()); // Prints 555.67

// Set the precision of od to 3 and scale to 0
OracleDecimal odp3s0 = OracleDecimal.ConvertToPrecScale(od,3,0);
Console.WriteLine(odp3s0.ToString()); // Prints 556


Divide

This method divides one OracleDecimal value by another.


Declaration
// C#
public static OracleDecimal Divide(OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

A new OracleDecimal structure.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Floor

This method returns a new OracleDecimal structure with its value set to the floor of the supplied OracleDecimal structure.


Declaration
// C#
public static OracleDecimal Floor(OracleDecimal val);

Parameters

Return Value

A new OracleDecimal structure.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Max

This method returns the maximum value of the two supplied OracleDecimal structures.


Declaration
// C#
public static OracleDecimal Max(OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

An OracleDecimal structure that has the greater value.


Min

This method returns the minimum value of the two supplied OracleDecimal structures.


Declaration
// C#
public static OracleDecimal Min(OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

An OracleDecimal structure that has the smaller value.


Mod

This method returns a new OracleDecimal structure with its value set to the modulus of two OracleDecimal structures.


Declaration
// C#
public static OracleDecimal Mod(OracleDecimal val1, OracleDecimal divider);

Parameters

Return Value

An OracleDecimal.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Multiply

This method returns a new OracleDecimal structure with its value set to the result of multiplying two OracleDecimal structures.


Declaration
// C#
public static OracleDecimal Multiply(OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

A new OracleDecimal structure.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Negate

This method returns a new OracleDecimal structure with its value set to the negation of the supplied OracleDecimal structures.


Declaration
// C#
public static OracleDecimal Negate(OracleDecimal val);

Parameters

Return Value

A new OracleDecimal structure.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Parse

This method converts a string to an OracleDecimal.


Declaration
// C#
public static OracleDecimal Parse (string str);

Parameters

Return Value

A new OracleDecimal structure.


Exceptions

ArgumentException - The numStr parameter is an invalid string representation of an OracleDecimal.

ArgumentNullException - The numStr parameter is null.

OverFlowException - The value of numStr is greater than the maximum value or less than the minimum value of OracleDecimal.


Round

This method returns a new OracleDecimal structure with its value set to that of the supplied OracleDecimal structure and rounded off to the specified place.


Declaration
// C#
public static OracleDecimal Round(OracleDecimal val, int decplace);

Parameters

Return Value

An OracleDecimal structure.


Remarks

If the supplied OracleDecimal structure has a null value, the returned OracleDecimal has a null value.


SetPrecision

This method returns a new OracleDecimal structure with a new specified precision.


Declaration
// C#
public static OracleDecimal SetPrecision(OracleDecimal val, int precision);

Parameters

Return Value

An OracleDecimal structure.


Remarks

The returned OracleDecimal is rounded off if the specified precision is smaller than the precision of val.

If val has a null value, the returned OracleDecimal has a null value.


Example
// C#
OracleDecimal od = new OracleDecimal(555.6666);

// Set the precision of od to 3
OracleDecimal odp3 = OracleDecimal.SetPrecision(od,3);
Console.WriteLine(odp3.ToString()); // Prints 556

// Set the precision of od to 4
OracleDecimal odp4 = OracleDecimal.SetPrecision(od,4);
Console.WriteLine(odp4.ToString()); // Prints 555.7


Shift

This method returns a new OracleDecimal structure with its value set to that of the supplied OracleDecimal structure, and its decimal place shifted to the specified number of places to the right.


Declaration
// C#
public static OracleDecimal Shift(OracleDecimal val, int decplaces);

Parameters

Return Value

An OracleDecimal structure.


Remarks

If the supplied OracleDecimal structure has a null value, the returned OracleDecimal has a null value.

If decplaces is negative, the shift is to the left.


Sign

This method determines the sign of an OracleDecimal structure.


Declaration
// C#
public static int Sign(OracleDecimal val);

Parameters

Return Value

Exceptions

OracleNullValueException - The argument has a null value.


Sqrt

This method returns a new OracleDecimal structure with its value set to the square root of the supplied OracleDecimal structure.


Declaration
// C#
public static OracleDecimal Sqrt(OracleDecimal val);

Parameters

Return Value

An OracleDecimal structure.


Exceptions

ArgumentOutOfRangeException - The provided OracleDecimal structure is less than zero.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Subtract

This method returns a new OracleDecimal structure with its value set to result of subtracting one OracleDecimal structure from another.


Declaration
// C#
public static OracleDecimal Subtract(OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

An OracleDecimal structure.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Truncate

This method truncates the OracleDecimal at a specified position.


Declaration
// C#
public static OracleDecimal Truncate(OracleDecimal val, int pos);

Parameters

Return Value

An OracleDecimal structure.


Remarks

If the supplied OracleDecimal structure has a null value, the returned OracleDecimal has a null value.

OracleDecimal Static (Logarithmic) Methods

The OracleDecimal static (logarithmic) methods are listed in Table 5-41.

Table 5-41 OracleDecimal Static (Logarithmic) Methods

Methods Description
Exp Returns a new OracleDecimal structure with its value set to e raised to the supplied power
Log Returns the supplied OracleDecimal structure with its value set to the logarithm of the supplied OracleDecimal structure (Overloaded)
Pow Returns a new OracleDecimal structure with its value set to the supplied OracleDecimal structure raised to the supplied power (Overloaded)


Exp

This method returns a new OracleDecimal structure with its value set to e raised to the supplied OracleDecimal.


Declaration
// C#
public static OracleDecimal Exp(OracleDecimal val);

Parameters

Return Value

An OracleDecimal structure.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.

Log

Log returns the supplied OracleDecimal structure with its value set to the logarithm of the supplied OracleDecimal structure.


Overload List:

Log(OracleDecimal)

This method returns a new OracleDecimal structure with its value set to the natural logarithm (base e) of the supplied OracleDecimal structure.


Declaration
// C#
public static OracleDecimal Log(OracleDecimal val);

Parameters

Return Value

Returns a new OracleDecimal structure with its value set to the natural logarithm (base e) of val.


Exceptions

ArgumentOutOfRangeException - The supplied OracleDecimal value is less than zero.


Remarks

If the supplied OracleDecimal structure has a null value, the returned OracleDecimal has a null value.

If the supplied OracleDecimal structure has zero value, the result is undefined, and the returned OracleDecimal structure has a null value.


Log(OracleDecimal, int)

This method returns the supplied OracleDecimal structure with its value set to the logarithm of the supplied OracleDecimal structure in the supplied base.


Declaration
// C#
public static OracleDecimal Log(OracleDecimal val, int logBase);

Parameters

Return Value

A new OracleDecimal structure with its value set to the logarithm of val in the supplied base.


Exceptions

ArgumentOutOfRangeException - Either argument is less than zero.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.

If both arguments have zero value, the result is undefined, and the returned OracleDecimal structure has a null value.


Log(OracleDecimal, OracleDecimal)

This method returns the supplied OracleDecimal structure with its value set to the logarithm of the supplied OracleDecimal structure in the supplied base.


Declaration
// C#
public static OracleDecimal Log(OracleDecimal val, OracleDecimal logBase);

Parameters

Return Value

Returns the logarithm of val in the supplied base.


Exceptions

ArgumentOutOfRangeException - Either the val or logBase parameter is less than zero.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.

If both arguments have zero value, the result is undefined, and the returned OracleDecimal structure has a null value.

Pow

Pow returns a new OracleDecimal structure with its value set to the supplied OracleDecimal structure raised to the supplied power.


Overload List:

Pow(OracleDecimal, int)

This method returns a new OracleDecimal structure with its value set to the supplied OracleDecimal value raised to the supplied Int32 power.


Declaration
// C#
public static OracleDecimal Pow(OracleDecimal val, int power);

Parameters

Return Value

An OracleDecimal structure.


Remarks

If the supplied OracleDecimal structure has a null value, the returned OracleDecimal has a null value.


Pow(OracleDecimal, OracleDecimal)

This method returns a new OracleDecimal structure with its value set to the supplied OracleDecimal structure raised to the supplied OracleDecimal power.


Declaration
// C#
public static OracleDecimal Pow(OracleDecimal val, OracleDecimal power);

Parameters

Return Value

An OracleDecimal structure.


Remarks

If the supplied OracleDecimal structure has a null value, the returned OracleDecimal has a null value.

OracleDecimal Static (Trigonometric) Methods

The OracleDecimal static (trigonometric) methods are listed in Table 5-42.

Table 5-42 OracleDecimal Static (Trigonometric) Methods

Methods Description
Acos Returns an angle in radian whose cosine is the supplied OracleDecimal structure
Asin Returns an angle in radian whose sine is the supplied OracleDecimal structure
Atan Returns an angle in radian whose tangent is the supplied OracleDecimal structure
Atan2 Returns an angle in radian whose tangent is the quotient of the two supplied OracleDecimal structures
Cos Returns the cosine of the supplied angle in radian
Sin Returns the sine of the supplied angle in radian
Tan Returns the tangent of the supplied angle in radian
Cosh Returns the hyperbolic cosine of the supplied angle in radian
Sinh Returns the hyperbolic sine of the supplied angle in radian
Tanh Returns the hyperbolic tangent of the supplied angle in radian


Acos

This method returns an angle in radian whose cosine is the supplied OracleDecimal structure.


Declaration
// C#
public static OracleDecimal Acos(OracleDecimal val);

Parameters

Return Value

An OracleDecimal structure that represents an angle in radian.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Asin

This method returns an angle in radian whose sine is the supplied OracleDecimal structure.


Declaration
// C#
public static OracleDecimal Asin(OracleDecimal val);

Parameters

Return Value

An OracleDecimal structure that represents an angle in radian.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Atan

This method returns an angle in radian whose tangent is the supplied OracleDecimal structure


Declaration
// C#
public static OracleDecimal Atan(OracleDecimal val);

Parameters

Return Value

An OracleDecimal structure that represents an angle in radian.


Remarks

If the argument has a null value, the returned OracleDecimal has a null value.


Atan2

This method returns an angle in radian whose tangent is the quotient of the two supplied OracleDecimal structures.


Declaration
// C#
public static OracleDecimal Atan2(OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

An OracleDecimal structure that represents an angle in radian.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Cos

This method returns the cosine of the supplied angle in radian.


Declaration
// C#
public static OracleDecimal Cos(OracleDecimal val);

Parameters

Return Value

An OracleDecimal instance.


Exceptions

ArgumentOutOfRangeException - The val parameter is positive or negative infinity.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Sin

This method returns the sine of the supplied angle in radian.


Declaration
// C#
public static OracleDecimal Sin(OracleDecimal val);

Parameters

Return Value

An OracleDecimal structure that represents an angle in radian.


Exceptions

ArgumentOutOfRangeException - The val parameter is positive or negative infinity.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Tan

This method returns the tangent of the supplied angle in radian.


Declaration
// C#
public static OracleDecimal Tan(OracleDecimal val);

Parameters

Return Value

An OracleDecimal instance.


Exceptions

ArgumentOutOfRangeException - The val parameter is positive or negative infinity.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Cosh

This method returns the hyperbolic cosine of the supplied angle in radian.


Declaration
// C#
public static OracleDecimal Cosh(OracleDecimal val);

Parameters

Return Value

An OracleDecimal instance.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Sinh

This method returns the hyperbolic sine of the supplied angle in radian.


Declaration
// C#
public static OracleDecimal Sinh(OracleDecimal val);

Parameters

Return Value

An OracleDecimal instance.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.


Tanh

This method returns the hyperbolic tangent of the supplied angle in radian.


Declaration
// C#
public static OracleDecimal Tanh(OracleDecimal val);

Parameters

Return Value

An OracleDecimal instance.


Remarks

If either argument has a null value, the returned OracleDecimal has a null value.

OracleDecimal Static (Comparison) Operators

The OracleDecimal static (comparison) operators are listed in Table 5-43.

Table 5-43 OracleDecimal Static (Comparison) Operators

Operator Description
operator + Adds two OracleDecimal values
operator / Divides one OracleDecimal value by another
operator == Determines if the two OracleDecimal values are equal
operator > Determines if the first of two OracleDecimal values is greater than the second
operator >= Determines if the first of two OracleDecimal values is greater than or equal to the second
operator != Determines if the two OracleDecimal values are not equal
operator < Determines if the first of two OracleDecimal values is less than the second
operator <= Determines if the first of two OracleDecimal values is less than or equal to the second
operator * Multiplies two OracleDecimal structures
operator - Subtracts one OracleDecimal structure from another
operator - Negates an OracleDecimal structure
operator% Returns a new OracleDecimal structure with its value set to the modulus of two OracleDecimal structures.


operator +

This method adds two OracleDecimal values.


Declaration
// C#
public static OracleDecimal operator + (OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

An OracleDecimal structure.


Remarks

If either operand has a null value, the returned OracleDecimal has a null value.


operator /

This method divides one OracleDecimalvalue by another.


Declaration
// C#
public static OracleDecimal operator / (OracleDecimal val1, OracleDecimal val2);

Parameters

Second OracleDecimal.


Return Value

An OracleDecimal structure.


Remarks

If either operand has a null value, the returned OracleDecimal has a null value.


operator ==

This method determines if two OracleDecimal values are equal.


Declaration
// C#
public static bool operator == (OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

Returns true if their values are equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator >

This method determines if the first of two OracleDecimal values is greater than the second.


Declaration
// C#
public static bool operator > (OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

Returns true if the two OracleDecimal values are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator >=

This method determines if the first of two OracleDecimal values is greater than or equal to the second.


Declaration
// C#
public static bool operator >= (OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

Returns true if the first of two OracleDecimal values is greater than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator !=

This method determines if the first of two OracleDecimal values are not equal.


Declaration
// C#
public static bool operator != (OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

Returns true if the two OracleDecimal values are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <

This method determines if the first of two OracleDecimal values is less than the second.


Declaration
// C#
public static bool operator < (OracleDecimal val1,  OracleDecimal val2);

Parameters

Return Value

Returns true if the first of two OracleDecimal values is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <=

This method determines if the first of two OracleDecimal values is less than or equal to the second.


Declaration
// C#
public static bool operator <= (OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

Returns true if the first of two OracleDecimal values is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator *

This method multiplies two OracleDecimal structures.


Declaration
// C#
public static OracleDecimal operator * (OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

A new OracleDecimal structure.


Remarks

If either operand has a null value, the returned OracleDecimal has a null value.


operator -

This method subtracts one OracleDecimal structure from another.


Declaration
// C#
public static OracleDecimal operator - (OracleDecimal val1, OracleDecimal val2);

Parameters

Return Value

A new OracleDecimal structure.


Remarks

If either operand has a null value, the returned OracleDecimal has a null value.


operator -

This method negates the supplied OracleDecimal structure.


Declaration
// C#
public static OracleDecimal operator - (OracleDecimal val);

Parameters

Return Value

A new OracleDecimal structure.


Remarks

If the supplied OracleDecimal structure has a null value, the returned OracleDecimal has a null value.


operator%

This method returns a new OracleDecimal structure with its value set to the modulus of two OracleDecimal structures.


Declaration
// C#
public static OracleDecimal operator % (OracleDecimal val, 
     OracleDecimal divider);

Parameters

Return Value

A new OracleDecimal structure.


Remarks

If either operand has a null value, the returned OracleDecimal has a null value.

OracleDecimal Static Operators (Conversion from .NET Type to OracleDecimal)

The OracleDecimal static operators (Conversion from .NET Type to OracleDecimal) are listed in Table 5-44.

Table 5-44 OracleDecimal Static Operators (Conversion from .NET Type to OracleDecimal)

Operator Description
implicit operator OracleDecimal Converts an instance value to an OracleDecimal structure (Overloaded)
explicit operator OracleDecimal Converts an instance value to an OracleDecimal structure (Overloaded)

implicit operator OracleDecimal

implicit operator OracleDecimal returns the OracleDecimal representation of a value.


Overload List:

implicit operator OracleDecimal(decimal)

This method returns the OracleDecimal representation of a decimal value.


Declaration
// C#
public static implicit operator OracleDecimal(decimal val);

Parameters

Return Value

An OracleDecimal.


implicit operator OracleDecimal(int)

This method returns the OracleDecimal representation of an int value.


Declaration
// C#
public static implicit operator OracleDecimal(int val);

Parameters

Return Value

An OracleDecimal.


implicit operator OracleDecimal(long)

This method returns the OracleDecimal representation of a long value.


Declaration
// C#
public static implicit operator OracleDecimal(long val);

Parameters

Return Value

An OracleDecimal.

explicit operator OracleDecimal

OracleDecimal returns the OracleDecimal representation of a value.


Overload List:

explicit operator OracleDecimal(double)

This method returns the OracleDecimal representation of a double.


Declaration
// C#
public static explicit operator OracleDecimal(double val);

Parameters

Return Value

An OracleDecimal.


Exceptions

OverFlowException - The value of the supplied double is greater than the maximum value of OracleDecimal or less than the minimum value of OracleDecimal.


Remarks

OracleDecimal contains the following values depending on the provided double value:


explicit operator OracleDecimal(string)

This method returns the OracleDecimal representation of a string.


Declaration
// C#
public static explicit operator OracleDecimal(string numStr);

Parameters

Return Value

An OracleDecimal.


Exceptions

ArgumentException - The numStr parameter is an invalid string representation of an OracleDecimal.

OracleDecimal Static Operators (Conversion from OracleDecimal to .NET)

The OracleDecimal static operators (Conversion from OracleDecimal to .NET) are listed in Table 5-45.

Table 5-45 OracleDecimal Static Operators (Conversion from OracleDecimal to .NET)

Operator Description
explicit operator byte Returns the byte representation of the OracleDecimal value
explicit operator decimal Returns the decimal representation of the OracleDecimal value
explicit operator double Returns the double representation of the OracleDecimal value
explicit operator short Returns the short representation of the OracleDecimal value
explicit operator int Returns the int representation of the OracleDecimal value
explicit operator long Returns the long representation of the OracleDecimal value
explicit operator float Returns the float representation of the OracleDecimal value


explicit operator byte

This method returns the byte representation of the OracleDecimal value.


Declaration
// C#
public static explicit operator byte(OracleDecimal val);

Parameters

Return Value

A byte.


Exceptions

OracleNullValueException - OracleDecimal has a null value.

OverFlowException- The byte cannot represent the supplied OracleDecimal structure.


explicit operator decimal

This method returns the decimal representation of the OracleDecimal value.


Declaration
// C#
public static explicit operator decimal(OracleDecimal val);

Parameters

Return Value

A decimal.


Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The decimal cannot represent the supplied OracleDecimal structure.


explicit operator double

This method returns the double representation of the OracleDecimal value.


Declaration
// C#
public static explicit operator double(OracleDecimal val);

Parameters

Return Value

A double.


Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The double cannot represent the supplied OracleDecimal structure.


explicit operator short

This method returns the short representation of the OracleDecimal value.


Declaration
// C#
public static explicit operator short(OracleDecimal val);

Parameters

Return Value

A short.


Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The short cannot represent the supplied OracleDecimal structure.


explicit operator int

This method returns the int representation of the OracleDecimal value.


Declaration
// C#
public static explicit operator int(OracleDecimal val);

Parameters

Return Value

An int.


Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The int cannot represent the supplied OracleDecimal structure.


explicit operator long

This method returns the long representation of the OracleDecimal value.


Declaration
// C#
public static explicit operator long(OracleDecimal val);

Parameters

Return Value

A long.


Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The long cannot represent the supplied OracleDecimal structure.


explicit operator float

This method returns the float representation of the OracleDecimal value.


Declaration
// C#
public static explicit operator float(OracleDecimal val);

Parameters

Return Value

A float.


Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The float cannot represent the supplied OracleDecimal structure.

OracleDecimal Properties

The OracleDecimal properties are listed in Table 5-46.

Table 5-46 OracleDecimal Properties

Properties Description
BinData Returns a byte array that represents the Oracle NUMBER in Oracle internal format
Format Specifies the format for ToString()
IsInt Indicates whether the current instance is an integer
IsNull Indicates whether the current instance has a null value
IsPositive Indicates whether the current instance is greater than 0
IsZero Indicates whether the current instance has a zero value
Value Returns a decimal value


BinData

This property returns a byte array that represents the Oracle NUMBER in an internal Oracle format.


Declaration
// C#
public byte[] BinData {get;}

Property Value

A byte array that represents the Oracle NUMBER in an internal Oracle format.


Exceptions

OracleNullValueException - The current instance has a null value.


Format

This property specifies the format for ToString().


Declaration
// C#
public string Format {get; set;}

Property Value

The string which specifies the format.


Remarks

Format is used when ToString() is called on an instance of an OracleDecimal. It is useful if the ToString() method needs a specific currency symbol, group, or decimal separator as part of a string.

By default, this property is null which indicates that no special formatting is used.

The decimal and group separator characters are specified by the thread's OracleGlobalization.NumericCharacters.

The currency symbols are specified by the following thread properties:


IsInt

This property indicates whether the current instance is an integer value.


Declaration
// C#
public bool IsInt {get;}

Property Value

A bool value that returns true if the current instance is an integer value; otherwise, returns false.


Exceptions

OracleNullValueException - The current instance has a null value.


IsNull

This property indicates whether the current instance has a null value.


Declaration
// C#
public bool IsNull {get;}

Property Value

A bool value that returns true if the current instance has a null value; otherwise, returns false.


IsPositive

This property indicates whether the value of the current instance is greater than 0.


Declaration
// C#
public bool IsPositive {get;}

Property Value

A bool value that returns true if the current instance is greater than 0; otherwise, returns false.


Exceptions

OracleNullValueException - The current instance has a null value.


IsZero

This property indicates whether the current instance has a zero value.


Declaration
// C#
public  bool IsZero{get;}

Property Value

A bool value that returns true if the current instance has a zero value; otherwise, returns false.


Exceptions

OracleNullValueException - The current instance has a null value.


Value

This method returns a decimal value.


Declaration
// C#
public decimal Value {get;}

Property Value

A decimal value.


Exceptions

OracleNullValueException - The current instance has a null value.

OverFlowException - The decimal cannot represent the supplied OracleDecimal structure.


Remarks

Precision can be lost when the decimal value is obtained from an OracleDecimal. See Remarks under "OracleDecimal Structure" for further information.

OracleDecimal Instance Methods

The OracleDecimal instance methods are listed in Table 5-47.

Table 5-47 OracleDecimal Instance Methods

Method Description
CompareTo Compares the current instance to the supplied object and returns an integer that represents their relative values
Equals Determines whether an object is an instance of OracleDecimal, and whether the value of the object is equal to the current instance (Overloaded)
GetHashCode Returns a hash code for the current instance
GetType Inherited from Object
ToByte Returns the byte representation of the current instance
ToDouble Returns the double representation of the current instance
ToInt16 Returns the Int16 representation of the current instance
ToInt32 Returns the Int32 representation of the current instance
ToInt64 Returns the Int64 representation of the current instance
ToSingle Returns the Single representation of the current instance
ToString Overloads Object.ToString()

Returns the string representation of the current instance



CompareTo

This method compares the current instance to the supplied object and returns an integer that represents their relative values.


Declaration
// C#
public int CompareTo(object obj);

Parameters

Return Value

The method returns a number:


Implements

IComparable


Exceptions

ArgumentException - The parameter is not of type OracleDecimal.


Remarks

The following rules apply to the behavior of this method.


Equals

Overrides Object

This method determines whether an object is an instance of OracleDecimal, and whether the value of the object is equal to the current instance.


Declaration
// C#
public override bool Equals(object obj);

Parameters

Return Value

Returns true if obj is an instance of OracleDecimal, and the value of obj is equal to the current instance; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GetHashCode

Overrides Object

This method returns a hash code for the current instance.


Declaration
// C#
public override int GetHashCode();

Return Value

Returns a hash code.


ToByte

This method returns the byte representation of the current instance.


Declaration
// C#
public byte ToByte();

Return Value

A byte.


Exceptions

OverFlowException - The byte cannot represent the current instance.

OracleNullValueException - The current instance has a null value.


ToDouble

This method returns the double representation of the current instance.


Declaration
// C#
public double ToDouble();

Return Value

A double.


Exceptions

OverFlowException - The double cannot represent the current instance.

OracleNullValueException - The current instance has a null value.


ToInt16

This method returns the Int16 representation of the current instance.


Declaration
// C#
public short ToInt16();

Return Value

A short.


Exceptions

OverFlowException - The short cannot represent the current instance.

OracleNullValueException - The current instance has a null value.


ToInt32

This method returns the Int32 representation of the current instance.


Declaration
// C#
public int ToInt32();

Return Value

An int.


Exceptions

OverFlowException - The int cannot represent the current instance.

OracleNullValueException - The current instance has a null value.


ToInt64

This method returns the Int64 representation of the current instance.


Declaration
// C#
public long ToInt64();

Return Value

A long.


Exceptions

OverFlowException - The long cannot represent the current instance.

OracleNullValueException - The current instance has a null value.


ToSingle

This method returns the Single representation of the current instance.


Declaration
// C#
public float ToSingle();

Return Value

A float.


Exceptions

OverFlowException - The float cannot represent the current instance.

OracleNullValueException - The current instance has a null value.


ToString

Overrides Object

This method returns the string representation of the current instance.


Declaration
// C#
public override string ToString();

Return Value

Returns the number in a string.


Remarks

If the current instance has a null value, the returned string is "null".

The returned value is a string representation of an OracleDecimal in the numeric format specified by the Format property.

The decimal and group separator characters are specified by the thread's OracleGlobalization.NumericCharacters.

The currency symbols are specified by the following thread properties:

If the numeric format is not specified, an Oracle default value is used.


OracleIntervalDS Structure

The OracleIntervalDS structure represents the Oracle INTERVAL DAY TO SECOND datatype to be stored in or retrieved from a database. Each OracleIntervalDS stores a period of time in term of days, hours, minutes, seconds, and fractional seconds.


Class Inheritance

Object

  ValueType

    OracleIntervalDS


Declaration
// C#
public struct OracleIntervalDS : IComparable

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.


Example
// C#
//  Illustrates usage of OracleIntervalDS

OracleIntervalDS idsMax = OracleIntervalDS.MaxValue;
double maxDays = idsMax.TotalDays;
maxDays -= 1;
OracleIntervalDS idsMax_1 = new OracleIntervalDS(maxDays);

// Calculate the difference. It should be 1 +/- epsilon days
// where epsilon for OracleIntervalDS = 0.000000001 seconds.

OracleIntervalDS idsDiff = idsMax - idsMax_1;

// If the difference isnt exactly 1 day, display the difference
if (idsDiff.TotalDays != 1)
   Console.WriteLine(idsDiff.ToString());


Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

OracleIntervalDS Members

OracleIntervalDS members are listed in the following tables:


OracleIntervalDS Constructors

OracleIntervalDS constructors are listed in Table 5-48

Table 5-48 OracleIntervalDS Constructors

Constructor Description
OracleIntervalDS Constructors Instantiates a new instance of OracleIntervalDS structure (Overloaded)


OracleIntervalDS Static Fields

The OracleIntervalDS static fields are listed in Table 5-49.

Table 5-49 OracleIntervalDS Static Fields

Field Description
MaxValue Represents the maximum valid time interval for an OracleIntervalDS structure
MinValue Represents the minimum valid time interval for an OracleIntervalDS structure
Null Represents a null value that can be assigned to an OracleIntervalDS instance
Zero Represents a zero value for an OracleIntervalDS structure


OracleIntervalDS Static Methods

The OracleIntervalDS static methods are listed in Table 5-50.

Table 5-50 OracleIntervalDS Static Methods

Methods Description
Equals Determines whether two OracleIntervalDS values are equal (Overloaded)
GreaterThan Determines whether one OracleIntervalDS value is greater than another
GreaterThanOrEqual Determines whether one OracleIntervalDS value is greater than or equal to another
LessThan Determines whether one OracleIntervalDS value is less than another
LessThanOrEqual Determines whether one OracleIntervalDS value is less than or equal to another
NotEquals Determines whether two OracleIntervalDS values are not equal
Parse Returns an OracleIntervalDS structure and sets its value for time interval using a string
SetPrecision Returns a new instance of an OracleIntervalDS with the specified day precision and fractional second precision


OracleIntervalDS Static Operators

The OracleIntervalDS static operators are listed in Table 5-51.

Table 5-51 OracleIntervalDS Static Operators

Operator Description
operator + Adds two OracleIntervalDS values
operator == Determines whether two OracleIntervalDS values are equal
operator > Determines whether one OracleIntervalDS value is greater than another
operator >= Determines whether one OracleIntervalDS value is greater than or equal to another
operator != Determines whether two OracleIntervalDS values are not equal
operator < Determines whether one OracleIntervalDS value is less than another
operator <= Determines whether one OracleIntervalDS value is less than or equal to another
operator - Subtracts one OracleIntervalDS value from another
operator - Negates an OracleIntervalDS structure
operator * Multiplies an OracleIntervalDS value by a number
operator / Divides an OracleIntervalDS value by a number


OracleIntervalDS Type Conversions

The OracleIntervalDS type conversions are listed in Table 5-52.

Table 5-52 OracleIntervalDS Type Conversions

Operator Description
explicit operator TimeSpan Converts an OracleIntervalDS structure to a TimeSpan structure
explicit operator OracleIntervalDS Converts a string to an OracleIntervalDS structure
implicit operator OracleIntervalDS Converts a TimeSpan structure to an OracleIntervalDS structure


OracleIntervalDS Properties

The OracleIntervalDS properties are listed in Table 5-53.

Table 5-53 OracleIntervalDS Properties

Properties Description
BinData Returns an array of bytes that represents the Oracle INTERVAL DAY TO SECOND in Oracle internal format
Days Gets the days component of an OracleIntervalDS
Hours Gets the hours component of an OracleIntervalDS
IsNull Indicates whether the current instance has a null value
Milliseconds Gets the milliseconds component of an OracleIntervalDS
Minutes Gets the minutes component of an OracleIntervalDS
Nanoseconds Gets the nanoseconds component of an OracleIntervalDS
Seconds Gets the seconds component of an OracleIntervalDS
TotalDays Returns the total number, in days, that represent the time period in the OracleIntervalDS structure
Value Specifies the time interval that is stored in the OracleIntervalDS structure


OracleIntervalDS Methods

The OracleIntervalDS methods are listed in Table 5-54.

Table 5-54 OracleIntervalDS Methods

Methods Description
CompareTo Compares the current OracleIntervalDS instance to an object, and returns an integer that represents their relative values
Equals Determines whether the specified object has the same time interval as the current instance (Overloaded)
GetHashCode Returns a hash code for the OracleIntervalDS instance
GetType Inherited from Object
ToString Converts the current OracleIntervalDS structure to a string

OracleIntervalDS Constructors

OracleIntervalDS constructors create a new instance of the OracleIntervalDS structure.


Overload List:

OracleIntervalDS(TimeSpan)

This constructor creates a new instance of the OracleIntervalDS structure and sets its value using a TimeSpan structure.


Declaration
// C#
public OracleIntervalDS(TimeSpan ts);  

Parameters

OracleIntervalDS(string)

This constructor creates a new instance of the OracleIntervalDS structure and sets its value using a string that indicates a period of time.


Declaration
// C#
public OracleIntervalDS(string intervalStr);  

Parameters

Exceptions

ArgumentException - The intervalStr parameter is not in the valid format or has an invalid value.

ArgumentNullException - The intervalStr parameter is null.


Remarks

The value specified in the supplied intervalStr must be in Day HH:MI:SSxFF format.


Example

"1 2:3:4.99" means 1 day, 2 hours, 3 minutes, 4 seconds, and 990 milliseconds or 1 day, 2 hours, 3 minutes, 4 seconds, and 990000000 nanoseconds.


OracleIntervalDS(double)

This constructor creates a new instance of the OracleIntervalDS structure and sets its value using the total number of days.


Declaration
// C#
public OracleIntervalDS(double totalDays);

Parameters

Exceptions

ArgumentOutOfRangeException - The argument value for one or more of the parameters is out of the specified range.

ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleIntervalDS.


OracleIntervalDS(int, int, int, int, double)

This constructor creates a new instance of the OracleIntervalDS structure and sets its value using the supplied days, hours, minutes, seconds, and milliseconds.


Declaration
// C#
public OracleIntervalDS (int days, int hours, int minutes, int seconds,
 double milliSeconds); 

Parameters

Exceptions

ArgumentOutOfRangeException - The argument value for one or more of the parameters is out of the specified range.

ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleIntervalDS.


Remarks

The sign of all the arguments must be the same.


OracleIntervalDS(int, int, int, int, int)

This constructor creates a new instance of the OracleIntervalDS structure and sets its value using the supplied days, hours, minutes, seconds, and nanoseconds.


Declaration
// C#
public OracleIntervalDS (int days, int hours, int minutes, int seconds,
 int nanoseconds);  

Parameters

Exceptions

ArgumentOutOfRangeException - The argument value for one or more of the parameters is out of the specified range.

ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleIntervalDS.


Remarks

The sign of all the arguments must be the same.


OracleIntervalDS(byte[ ])

This constructor creates a new instance of the OracleIntervalDS structure and sets its value to the provided byte array, which is in an internal Oracle INTERVAL DAY TO SECOND format.


Declaration
// C#
public OracleIntervalDS (byte[ ] bytes);

Parameters

Exceptions

ArgumentException - bytes is not in internal Oracle INTERVAL DAY TO SECOND format, or bytes is not a valid Oracle INTERVAL DAY TO SECOND.

ArgumentNullException - bytes is null.

OracleIntervalDS Static Fields

The OracleIntervalDS static fields are listed in Table 5-55.

Table 5-55 OracleIntervalDS Static Fields

Field Description
MaxValue Represents the maximum valid time interval for an OracleIntervalDS structure
MinValue Represents the minimum valid time interval for an OracleIntervalDS structure
Null Represents a null value that can be assigned to an OracleIntervalDS instance
Zero Represents a zero value for an OracleIntervalDS structure


MaxValue

This static field represents the maximum value for an OracleIntervalDS structure.


Declaration
// C#
public static readonly OracleIntervalDS MaxValue;

Remarks

Maximum values:


MinValue

This static field represents the minimum value for an OracleIntervalDS structure.


Declaration
// C#
public static readonly OracleIntervalDS MinValue;

Remarks

Minimum values:


Null

This static field represents a null value that can be assigned to an OracleIntervalDS instance.


Declaration
// C#
public static readonly OracleIntervalDS Null;

Zero

This static field represents a zero value for an OracleIntervalDS structure.


Declaration
// C#
public static readonly OracleIntervalDS Zero;

OracleIntervalDS Static Methods

The OracleIntervalDS static methods are listed in Table 5-56.

Table 5-56 OracleIntervalDS Static Methods

Methods Description
Equals Determines whether two OracleIntervalDS values are equal (Overloaded)
GreaterThan Determines whether one OracleIntervalDS value is greater than another
GreaterThanOrEqual Determines whether one OracleIntervalDS value is greater than or equal to another
LessThan Determines whether one OracleIntervalDS value is less than another
LessThanOrEqual Determines whether one OracleIntervalDS value is less than or equal to another
NotEquals Determines whether two OracleIntervalDS values are not equal
Parse Returns an OracleIntervalDS structure and sets its value for time interval using a string
SetPrecision Returns a new instance of an OracleIntervalDS with the specified day precision and fractional second precision


Equals

This static method determines whether two OracleIntervalDS values are equal.


Declaration
// C#
public static bool Equals(OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

If the two OracleIntervalDS structures represent the same time interval, returns true; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThan

This static method determines whether the first of two OracleIntervalDS values is greater than the second.


Declaration
// C#
public static bool GreaterThan(OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalDS values is greater than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThanOrEqual

This static method determines whether the first of two OracleIntervalDS values is greater than or equal to the second.


Declaration
// C#
public static bool GreaterThanOrEqual(OracleIntervalDS val1, 
   OracleIntervalDS val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalDS values is greater than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


LessThan

This static method determines whether the first of two OracleIntervalDS values is less than the second.


Declaration
// C#
public static bool LessThan(OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalDS values is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


LessThanOrEqual

This static method determines whether the first of two OracleIntervalDS values is less than or equal to the second.


Declaration
// C#
public static bool LessThanOrEqual(OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalDS values is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


NotEquals

This static method determines whether two OracleIntervalDS values are not equal.


Declaration
// C#
public static bool NotEquals(OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

Returns true if two OracleIntervalDS values are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


Parse

This static method returns an OracleIntervalDS instance and sets its value for time interval using a string.


Declaration
// C#
public static OracleIntervalDS Parse(string intervalStr);

Parameters

Return Value

Returns an OracleIntervalDS instance representing the time interval from the supplied string.


Exceptions

ArgumentException - The intervalStr parameter is not in the valid format or intervalStr has an invalid value.

ArgumentNullException - The intervalStr parameter is null.


Remarks

The value specified in intervalStr must be in Day HH:MI:SSxFF format.


Example

"1 2:3:4.99" means 1 day, 2 hours, 3 minutes, 4 seconds, and 990 milliseconds or 1 day, 2 hours, 3 minutes, 4 seconds, and 990000000 nanoseconds.


SetPrecision

This static method returns a new instance of an OracleIntervalDS with the specified day precision and fractional second precision.


Declaration
// C#
public static OracleIntervalDS SetPrecision(OracleIntervalDS value1,int dayPrecision, int fracSecPrecision);

Parameters

Return Value

An OracleIntervalDS instance.


Exceptions

ArgumentOutOfRangeException - An argument value is out of the specified range.


Remarks

Depending on the value specified in the supplied dayPrecision, 0 or more leading zeros are displayed in the string returned by ToString().

The value specified in the supplied fracSecPrecision is used to perform a rounding off operation on the supplied OracleIntervalDS value. Depending on this value, 0 or more trailing zeros are displayed in the string returned by ToString().


Example

The OracleIntervalDS with a value of "1 2:3:4.99" results in the string "001 2:3:4.99000" when SetPrecision() is called, with the day precision set to 3 and fractional second precision set to 5.

OracleIntervalDS Static Operators

The OracleIntervalDS static operators are listed in Table 5-57.

Table 5-57 OracleIntervalDS Static Operators

Operator Description
operator + Adds two OracleIntervalDS values
operator == Determines whether two OracleIntervalDS values are equal
operator > Determines whether one OracleIntervalDS value is greater than another
operator >= Determines whether one OracleIntervalDS value is greater than or equal to another
operator != Determines whether two OracleIntervalDS values are not equal
operator < Determines whether one OracleIntervalDS value is less than another
operator <= Determines whether one OracleIntervalDS value is less than or equal to another
operator - Subtracts one OracleIntervalDS value from another
operator - Negates an OracleIntervalDS structure
operator * Multiplies an OracleIntervalDS value by a number
operator / Divides an OracleIntervalDS value by a number


operator +

This static operator adds two OracleIntervalDS values.


Declaration
// C#
public static OracleIntervalDS operator + (OracleIntervalDS val1,  OracleIntervalDS val2);

Parameters

Return Value

An OracleIntervalDS.


Remarks

If either argument has a null value, the returned OracleIntervalDS structure has a null value.


operator ==

This static operator determines if two OracleIntervalDS values are equal.


Declaration
// C#
public static bool operator == (OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

Returns true if the two OracleIntervalDS values are the same; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


operator >

This static operator determines if the first of two OracleIntervalDS values is greater than the second.


Declaration
// C#
public static bool operator > (OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

Returns true if one OracleIntervalDS value is greater than another; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator >=

This static operator determines if the first of two OracleIntervalDS values is greater than or equal to the second.


Declaration
// C#
public static bool operator >= (OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalDS values is greater than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator !=

This static operator determines if the two OracleIntervalDS values are not equal.


Declaration
// C#
public static bool operator != (OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

Returns true if the two OracleIntervalDS values are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <

This static operator determines if the first of two OracleIntervalDS values is less than the second.


Declaration
// C#
public static bool operator < (OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalDS values is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <=

This static operator determines if the first of two OracleIntervalDS values is less than or equal to the second.


Declaration
// C#
public static bool operator <= (OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalDS values is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator -

This static operator subtracts one OracleIntervalDS structure from another.


Declaration
// C#
public static OracleIntervalDS operator - (OracleIntervalDS val1, OracleIntervalDS val2);

Parameters

Return Value

An OracleIntervalDS structure.


Remarks

If either argument has a null value, the returned OracleIntervalDS structure has a null value.


operator -

This static operator negates the supplied OracleIntervalDS structure.


Declaration
// C#
public static OracleIntervalDS operator - (OracleIntervalDS val);

Parameters

Return Value

An OracleIntervalDS structure.


Remarks

If the supplied OracleIntervalDS structure has a null value, the returned OracleIntervalDS structure has a null value.


operator *

This static operator multiplies an OracleIntervalDS value by a number.


Declaration
// C#
public static OracleIntervalDS operator * (OracleIntervalDS val1, int multiplier);

Parameters

Return Value

A new OracleIntervalDS instance.


Remarks

If the OracleIntervalDS structure has a null value, the returned OracleIntervalDS structure has a null value.


operator /

This static operator divides an OracleIntervalDS value by a number.


Declaration
// C#
public static OracleIntervalDS operator / (OracleIntervalDS val1, int divisor);

Parameters

Return Value

An OracleIntervalDS structure.


Remarks

If the OracleIntervalDS structure has a null value, the returned OracleIntervalDS structure has a null value.

OracleIntervalDS Type Conversions

The OracleIntervalDS type conversions are listed in Table 5-58.

Table 5-58 OracleIntervalDS Type Conversions

Operator Description
explicit operator TimeSpan Converts an OracleIntervalDS structure to a TimeSpan structure
explicit operator OracleIntervalDS Converts a string to an OracleIntervalDS structure
implicit operator OracleIntervalDS Converts a TimeSpan structure to an OracleIntervalDS structure


explicit operator TimeSpan

This type conversion operator converts an OracleIntervalDS structure to a TimeSpan structure.


Declaration
// C#
public static explicit operator TimeSpan(OracleIntervalDS val);

Parameters

Return Value

A TimeSpan structure.


Exceptions

OracleNullValueException - The OracleIntervalDS structure has a null value.


Remarks

explicit operator OracleIntervalDS

This type conversion operator converts a string to an OracleIntervalDS structure.


Declaration
// C#
public static explicit operator OracleIntervalDS (string intervalStr);

Parameters

Return Value

An OracleIntervalDS structure.


Exceptions

ArgumentException - The supplied intervalStr parameter is not in the correct format or has an invalid value.

ArgumentNullException - The intervalStr parameter is null.


Remarks

The returned OracleIntervalDS structure contains the same time interval represented by the supplied intervalStr. The value specified in the supplied intervalStr must be in Day HH:MI:SSxFF format.


Example

"1 2:3:4.99" means 1 day, 2 hours, 3 minutes 4 seconds and 990 milliseconds or 1 day, 2 hours, 3 minutes 4 seconds and 990000000 nanoseconds.


implicit operator OracleIntervalDS

This type conversion operator converts a TimeSpan structure to an OracleIntervalDS structure.


Declaration
// C#
public static implicit operator OracleIntervalDS(TimeSpan val);

Parameters

Return Value

An OracleIntervalDS structure.


Remarks

The returned OracleIntervalDS structure contains the same days, hours, seconds, and milliseconds as the supplied TimeSpan val.

OracleIntervalDS Properties

The OracleIntervalDS properties are listed in Table 5-59.

Table 5-59 OracleIntervalDS Properties

Properties Description
BinData Returns an array of bytes that represents the Oracle INTERVAL DAY TO SECOND in Oracle internal format
Days Gets the days component of an OracleIntervalDS
Hours Gets the hours component of an OracleIntervalDS
IsNull Indicates whether the current instance has a null value
Milliseconds Gets the milliseconds component of an OracleIntervalDS
Minutes Gets the minutes component of an OracleIntervalDS
Nanoseconds Gets the nanoseconds component of an OracleIntervalDS
Seconds Gets the seconds component of an OracleIntervalDS
TotalDays Returns the total number, in days, that represent the time period in the OracleIntervalDS structure
Value Specifies the time interval that is stored in the OracleIntervalDS structure


BinData

This property returns an array of bytes that represents the Oracle INTERVAL DAY TO SECOND in Oracle internal format.


Declaration
// C#
public byte[] BinData {get;}

Property Value

A byte array that represents an Oracle INTERVAL DAY TO SECOND in Oracle internal format.


Exceptions

OracleNullValueException - The current instance has a null value.


Remarks

Days

This property gets the days component of an OracleIntervalDS.


Declaration
// C#
public int Days {get;}

Property Value

An int representing the days component.


Exceptions

OracleNullValueException - The current instance has a null value.


Hours

This property gets the hours component of an OracleIntervalDS.


Declaration
// C#
public int Hours {get;}

Property Value

An int representing the hours component.


Exceptions

OracleNullValueException - The current instance has a null value.


IsNull

This property indicates whether the current instance has a null value.


Declaration
// C#
public bool IsNull {get;}

Property Value

Returns true if the current instance has a null value; otherwise, returns false.


Milliseconds

This property gets the milliseconds component of an OracleIntervalDS.


Declaration
// C#
public double Milliseconds {get;}

Property Value

A double that represents milliseconds component.


Exceptions

OracleNullValueException - The current instance has a null value.


Minutes

This property gets the minutes component of an OracleIntervalDS.


Declaration
// C#
public int Minutes {get;}

Property Value

A int that represents minutes component.


Exceptions

OracleNullValueException - The current instance has a null value.


Nanoseconds

This property gets the nanoseconds component of an OracleIntervalDS.


Declaration
// C#
public int Nanoseconds {get;}

Property Value

An int that represents nanoseconds component.


Exceptions

OracleNullValueException - The current instance has a null value.


Seconds

This property gets the seconds component of an OracleIntervalDS.


Declaration
// C#
public int Seconds {get;}

Property Value

An int that represents seconds component.


Exceptions

OracleNullValueException - The current instance has a null value.


TotalDays

This property returns the total number, in days, that represent the time period in the OracleIntervalDS structure.


Declaration
// C#
public double TotalDays {get;}

Property Value

A double that represents the total number of days.


Exceptions

OracleNullValueException - The current instance has a null value.


Value

This property specifies the time interval that is stored in the OracleIntervalDS structure.


Declaration
// C#
public TimeSpan Value {get;}

Property Value

A time interval.


Exceptions

OracleNullValueException - The current instance has a null value.

OracleIntervalDS Methods

The OracleIntervalDS methods are listed in Table 5-60.

Table 5-60 OracleIntervalDS Methods

Methods Description
CompareTo Compares the current OracleIntervalDS instance to an object, and returns an integer that represents their relative values
Equals Determines whether the specified object has the same time interval as the current instance (Overloaded)
GetHashCode Returns a hash code for the OracleIntervalDS instance
GetType Inherited from Object
ToString Converts the current OracleIntervalDS structure to a string


CompareTo

This method compares the current OracleIntervalDS instance to an object, and returns an integer that represents their relative values.


Declaration
// C#
public int CompareTo(object obj);

Parameters

Return Value

The method returns:


Implements

IComparable


Exceptions

ArgumentException - The obj parameter is not of type OracleIntervalDS.


Remarks

The following rules apply to the behavior of this method.


Equals

This method determines whether the specified object has the same time interval as the current instance.


Declaration
// C#
public override bool Equals(object obj);

Parameters

Return Value

Returns true if obj is of type OracleIntervalDS and has the same time interval as the current instance; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GetHashCode

Overrides Object

This method returns a hash code for the OracleIntervalDS instance.


Declaration
// C#
public override int GetHashCode();

ToString

Overrides Object

This method converts the current OracleIntervalDS structure to a string.


Declaration
// C#
public override string ToString();

Return Value

Returns a string.


Remarks

If the current instance has a null value, the returned string contains "null".


OracleIntervalYM Structure

The OracleIntervalYM structure represents the Oracle INTERVAL YEAR TO MONTH datatype to be stored in or retrieved from a database. Each OracleIntervalYM stores a period of time in years and months.


Class Inheritance

Object

  ValueType

    OracleIntervalYM


Declaration
// C#
public struct OracleIntervalYM : IComparable

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.


Example
// C#
//  Illustrates usage of OracleIntervalYM

OracleIntervalYM iymMax = OracleIntervalYM.MaxValue;
double maxYears = iymMax.TotalYears;
maxYears -= 1;
OracleIntervalYM iymMax_1 = new OracleIntervalYM(maxYears);

// Calculate the difference. It should be 1 +/- epsilon years
// where epsilon for OracleIntervalYM = 1 month.

OracleIntervalYM iymDiff = iymMax - iymMax_1;

// If the difference isnt exactly 1 day, display the difference
if (iymDiff.TotalYears != 1)
    Console.WriteLine(iymDiff.ToString());


Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

OracleIntervalYM Members

OracleIntervalYM members are listed in the following tables:


OracleIntervalYM Constructors

OracleIntervalYM constructors are listed in Table 5-61

Table 5-61 OracleIntervalYM Constructors

Constructor Description
OracleIntervalYM Constructors
Instantiates a new instance of OracleIntervalYM structure (Overloaded)


OracleIntervalYM Static Fields

The OracleIntervalYM static fields are listed in Table 5-62.

Table 5-62 OracleIntervalYM Static Fields

Field Description
MaxValue Represents the maximum value for an OracleIntervalYM structure
MinValue Represents the minimum value for an OracleIntervalYM structure
Null Represents a null value that can be assigned to an OracleIntervalYM instance
Zero Represents a zero value for an OracleIntervalYM structure


OracleIntervalYM Static Methods

The OracleIntervalYM static methods are listed in Table 5-63.

Table 5-63 OracleIntervalYM Static Methods

Methods Description
Equals Determines whether two OracleIntervalYM values are equal (Overloaded)
GreaterThan Determines whether one OracleIntervalYM value is greater than another
GreaterThanOrEqual Determines whether one OracleIntervalYM value is greater than or equal to another
LessThan Determines whether one OracleIntervalYM value is less than another
LessThanOrEqual Determines whether one OracleIntervalYM value is less than or equal to another
NotEquals Determines whether two OracleIntervalYM values are not equal
Parse Returns an OracleIntervalYM structure and sets its value for time interval using a string
SetPrecision Returns a new instance of an OracleIntervalYM with the specified year precision.


OracleIntervalYM Static Operators

The OracleIntervalYM static operators are listed in Table 5-64.

Table 5-64 OracleIntervalYM Static Operators

Operator Description
operator + Adds two OracleIntervalYM values
operator == Determines whether two OracleIntervalYM values are equal
operator > Determines whether one OracleIntervalYM value is greater than another
operator >= Determines whether one OracleIntervalYM value is greater than or equal to another
operator != Determines whether two OracleIntervalYM values are not equal
operator < Determines whether one OracleIntervalYM value is less than another
operator <= Determines whether one OracleIntervalYM value is less than or equal to another
operator - Subtracts one OracleIntervalYM value from another
operator - Negates an OracleIntervalYM structure
operator * Multiplies an OracleIntervalYM value by a number
operator / Divides an OracleIntervalYM value by a number


OracleIntervalYM Type Conversions

The OracleIntervalYM conversions are listed in Table 5-65.

Table 5-65 OracleIntervalYM Type Conversions

Operator Description
explicit operator long Converts an OracleIntervalYM structure to a number
explicit operator OracleIntervalYM Converts a string to an OracleIntervalYM structure
implicit operator OracleIntervalYM Converts the number of months to an OracleIntervalYM structure


OracleIntervalYM Properties

The OracleIntervalYM properties are listed in Table 5-66.

Table 5-66 OracleIntervalYM Properties

Properties Description
BinData Returns an array of bytes that represents the Oracle INTERVAL YEAR TO MONTH in an Oracle internal format
IsNull Indicates whether the current instance has a null value
Months Gets the months component of an OracleIntervalYM
TotalYears Returns the total number, in years, that represents the period of time in the current OracleIntervalYM structure
Value Specifies the total number of months that is stored in the OracleIntervalYM structure
Years Gets the years component of an OracleIntervalYM


OracleIntervalYM Methods

The OracleIntervalYM methods are listed in Table 5-67.

Table 5-67 OracleIntervalYM Methods

Methods Description
CompareTo Compares the current OracleIntervalYM instance to the supplied object, and returns an integer that represents their relative values
Equals Determines whether the specified object has the same time interval as the current instance (Overloaded)
GetHashCode Returns a hash code for the OracleIntervalYM instance
GetType Inherited from Object
ToString Converts the current OracleIntervalYM structure to a string

OracleIntervalYM Constructors

The OracleIntervalYM constructors creates a new instance of the OracleIntervalYM structure.


Overload List:

OracleIntervalYM(long)

This method creates a new instance of the OracleIntervalYM structure using the supplied total number of months for a period of time.


Declaration
// C#
public OracleIntervalYM (long totalMonths); 

Parameters

Exceptions

ArgumentOutOfRangeException - The totalMonths parameter is out of the specified range.


OracleIntervalYM(string)

This method creates a new instance of the OracleIntervalYM structure and sets its value using the supplied string.


Declaration
// C#
public OracleIntervalYM (string intervalStr);  

Parameters

Remarks

The value specified in the supplied intervalStr must be in Year-Month format.


Exceptions

ArgumentException - The intervalStr parameter is not in the valid format or intervalStr has an invalid value.

ArgumentNullException - The intervalStr parameter is null.


Example

"1-2" means 1 year and 2 months.


OracleIntervalYM(double)

This method creates a new instance of the OracleIntervalYM structure and sets its value using the total number of years.


Declaration
// C#
public OracleIntervalYM (double totalYears);

Parameters

Exceptions

ArgumentOutOfRangeException - The totalYears parameter is out of the specified range.

ArgumentException - The totalYears parameter cannot be used to construct a valid OracleIntervalYM.


OracleIntervalYM(int, int)

This method creates a new instance of the OracleIntervalYM structure and sets its value using years and months.


Declaration
// C#
public OracleIntervalYM (int years, int months); 

Parameters

Remarks

The sign of all the arguments must be the same.


Exceptions

ArgumentOutOfRangeException - The argument value for one or more of the parameters is out of the specified range.

ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleIntervalYM.


OracleIntervalYM(byte[ ])

This method creates a new instance of the OracleIntervalYM structure and sets its value to the provided byte array, which is in an internal Oracle INTERVAL DAY TO SECOND format.


Declaration
// C#
public OracleIntervalYM (byte[] bytes); 

Parameters

Exceptions

ArgumentException - The supplied byte array is not in an internal Oracle INTERVAL YEAR TO MONTH format or the supplied byte array has an invalid value.

ArgumentNullException - bytes is null.


Remarks

The supplied byte array must be in an internal Oracle INTERVAL YEAR TO MONTH format.

OracleIntervalYM Static Fields

The OracleIntervalYM static fields are listed in Table 5-68.

Table 5-68 OracleIntervalYM Static Fields

Field Description
MaxValue Represents the maximum value for an OracleIntervalYM structure
MinValue Represents the minimum value for an OracleIntervalYM structure
Null Represents a null value that can be assigned to an OracleIntervalYM instance
Zero Represents a zero value for an OracleIntervalYM structure


MaxValue

This static field represents the maximum value for an OracleIntervalYM structure.


Declaration
// C#
public static readonly OracleIntervalYM MaxValue;

Remarks

Year is 999999999 and Month is 11.


MinValue

This static field represents the minimum value for an OracleIntervalYM structure.


Declaration
// C#
public static readonly OracleIntervalYM MinValue;

Remarks

Year is -999999999 and Month is -11.


Null

This static field represents a null value that can be assigned to an OracleIntervalYM instance.


Declaration
// C#
public static readonly OracleIntervalYM Null;

Zero

This static field represents a zero value for an OracleIntervalYM structure.


Declaration
// C#
public static readonly OracleIntervalDS Zero;

OracleIntervalYM Static Methods

The OracleIntervalYM static methods are listed in Table 5-69.

Table 5-69 OracleIntervalYM Static Methods

Methods Description
Equals Determines whether two OracleIntervalYM values are equal (Overloaded)
GreaterThan Determines whether one OracleIntervalYM value is greater than another
GreaterThanOrEqual Determines whether one OracleIntervalYM value is greater than or equal to another
LessThan Determines whether one OracleIntervalYM value is less than another
LessThanOrEqual Determines whether one OracleIntervalYM value is less than or equal to another
NotEquals Determines whether two OracleIntervalYM values are not equal
Parse Returns an OracleIntervalYM structure and sets its value for time interval using a string
SetPrecision Returns a new instance of an OracleIntervalYM with the specified year precision.


Equals

This static method determines whether two OracleIntervalYM values are equal.


Declaration
// C#
public static bool Equals(OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if two OracleIntervalYM values represent the same time interval, otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThan

This static method determines whether the first of two OracleIntervalYM values is greater than the second.


Declaration
// C#
public static bool GreaterThan(OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalYM values is greater than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThanOrEqual

This static method determines whether the first of two OracleIntervalYM values is greater than or equal to the second.


Declaration
// C#
public static bool GreaterThanOrEqual(OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalYM values is greater than or equal to the second; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


LessThan

This static method determines whether the first of two OracleIntervalYM values is less than the second.


Declaration
// C#
public static bool LessThan(OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalYM values is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


LessThanOrEqual

This static method determines whether the first of two OracleIntervalYM values is less than or equal to the second.


Declaration
// C#
public static bool LessThanOrEqual(OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalYM values is less than or equal to the second. Returns false otherwise.


Remarks

The following rules apply to the behavior of this method.


NotEquals

This static method determines whether two OracleIntervalYM values are not equal.


Declaration
// C#
public static bool NotEquals(OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if two OracleIntervalYM values are not equal. Returns false otherwise.


Remarks

The following rules apply to the behavior of this method.


Parse

This static method returns an OracleIntervalYM structure and sets its value for time interval using a string.


Declaration
// C#
public static OracleIntervalYM Parse (string intervalStr);

Parameters

Return Value

Returns an OracleIntervalYM structure.


Exceptions

ArgumentException - The intervalStr parameter is not in the valid format or intervalStr has an invalid value.

ArgumentNullException - The intervalStr parameter is null.


Remarks

The value specified in the supplied intervalStr must be in the Year-Month format.


Example

"1-2" means 1 year and 2 months.


SetPrecision

This static method returns a new instance of an OracleIntervalYM with the specified year precision.


Declaration
// C#
public static OracleIntervalYM SetPrecision(OracleIntervalYM value1,int yearPrecision);

Parameters

Return Value

An OracleIntervalDS instance.


Exceptions

ArgumentOutOfRangeException - yearPrecision is out of the specified range.


Remarks

Depending on the value specified in the supplied yearPrecision, 0 or more leading zeros are displayed in the string returned by ToString().


Example

An OracleIntervalYM with a value of "1-2" results in the string "001-2" when SetPrecision() is called with the year precision set to 3.

OracleIntervalYM Static Operators

The OracleIntervalYM static operators are listed in Table 5-70.

Table 5-70 OracleIntervalYM Static Operators

Operator Description
operator + Adds two OracleIntervalYM values
operator == Determines whether two OracleIntervalYM values are equal
operator > Determines whether one OracleIntervalYM value is greater than another
operator >= Determines whether one OracleIntervalYM value is greater than or equal to another
operator != Determines whether two OracleIntervalYM values are not equal
operator < Determines whether one OracleIntervalYM value is less than another
operator <= Determines whether one OracleIntervalYM value is less than or equal to another
operator - Subtracts one OracleIntervalYM value from another
operator - Negates an OracleIntervalYM structure
operator * Multiplies an OracleIntervalYM value by a number
operator / Divides an OracleIntervalYM value by a number


operator +

This static operator adds two OracleIntervalYM values.


Declaration
// C#
public static OracleIntervalYM operator + (OracleIntervalYM val1,  OracleIntervalYM val2);

Parameters

Return Value

OracleIntervalYM


Remarks

If either argument has a null value, the returned OracleIntervalYM structure has a null value.


operator ==

This static operator determines if two OracleIntervalYM values are equal.


Declaration
// C#
public static bool operator == (OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if they are equal; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


operator >

This static operator determines if the first of two OracleIntervalYM values is greater than the second.


Declaration
// C#
public static bool operator > (OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if one OracleIntervalYM value is greater than another; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator >=

This static operator determines if the first of two OracleIntervalYM values is greater than or equal to the second.


Declaration
// C#
public static bool operator >= (OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if one OracleIntervalYM value is greater than or equal to another; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator !=

This static operator determines whether two OracleIntervalYM values are not equal.


Declaration
// C#
public static bool operator != (OracleIntervalYM val1, OracleIntervalYM val2)

Parameters

Return Value

Returns true if two OracleIntervalYM values are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <

This static operator determines if the first of two OracleIntervalYM values is less than the second.


Declaration
// C#
public static bool operator < (OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalYM values is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <=

This static operator determines if the first of two OracleIntervalYM values is less than or equal to the second.


Declaration
// C#
public static bool operator <= (OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

Returns true if the first of two OracleIntervalYM values is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator -

This static operator subtracts one OracleIntervalYM structure from another.


Declaration
// C#
public static OracleIntervalYM operator - (OracleIntervalYM val1, OracleIntervalYM val2);

Parameters

Return Value

An OracleIntervalYM structure.


Remarks

If either argument has a null value, the returned OracleIntervalYM structure has a null value.


operator -

This static operator negates an OracleIntervalYM structure.


Declaration
// C#
public static OracleIntervalYM operator - (OracleIntervalYM val);

Parameters

Return Value

An OracleIntervalYM structure.


Remarks

If the supplied OracleIntervalYM structure has a null value, the returned OracleIntervalYM structure has a null value.


operator *

This static operator multiplies an OracleIntervalYM value by a number.


Declaration
// C#
public static OracleIntervalYM operator * (OracleIntervalYM val1, int multiplier);

Parameters

Return Value

An OracleIntervalYM structure.


Remarks

If the supplied OracleIntervalYM structure has a null value, the returned OracleIntervalYM structure has a null value.


operator /

This static operator divides an OracleIntervalYM value by a number.


Declaration
// C#
public static OracleIntervalYM operator / (OracleIntervalYM val1, int divisor);

Parameters

Return Value

An OracleIntervalYM structure.


Remarks

If the supplied OracleIntervalYM structure has a null value, the returned OracleIntervalYM structure has a null value.

OracleIntervalYM Type Conversions

The OracleIntervalYM conversions are listed in Table 5-71.

Table 5-71 OracleIntervalYM Type Conversions

Operator Description
explicit operator long Converts an OracleIntervalYM structure to a number
explicit operator OracleIntervalYM Converts a string to an OracleIntervalYM structure
implicit operator OracleIntervalYM Converts the number of months to an OracleIntervalYM structure


explicit operator long

This type conversion operator converts an OracleIntervalYM to a number that represents the number of months in the time interval.


Declaration
// C#
public static explicit operator long (OracleIntervalYM val);

Parameters

Return Value

A long number in months.


Exceptions

OracleNullValueException - The OracleIntervalYM structure has a null value.


explicit operator OracleIntervalYM

This type conversion operator converts the string intervalStr to an OracleIntervalYM structure.


Declaration
// C#
public static explicit operator OracleIntervalYM (string intervalStr);

Parameters

Return Value

An OracleIntervalYM structure.


Exceptions

ArgumentException - The supplied intervalStr parameter is not in the correct format or has an invalid value.

ArgumentNullException - The intervalStr parameter is null.


Remarks

The returned OracleIntervalDS structure contains the same time interval represented by the supplied intervalStr. The value specified in the supplied intervalStr must be in Year-Month format.


implicit operator OracleIntervalYM

This type conversion operator converts the total number of months as time interval to an OracleIntervalYM structure.


Declaration
// C#
public static implicit operator OracleIntervalYM (long months);

Parameters

Return Value

An OracleIntervalYM structure.


Exceptions

ArgumentOutOfRangeException - The months parameter is out of the specified range.

OracleIntervalYM Properties

The OracleIntervalYM properties are listed in Table 5-72.

Table 5-72 OracleIntervalYM Properties

Properties Description
BinData Returns an array of bytes that represents the Oracle INTERVAL YEAR TO MONTH in an Oracle internal format
IsNull Indicates whether the current instance has a null value
Months Gets the months component of an OracleIntervalYM
TotalYears Returns the total number, in years, that represents the period of time in the current OracleIntervalYM structure
Value Specifies the total number of months that is stored in the OracleIntervalYM structure
Years Gets the years component of an OracleIntervalYM


BinData

This property returns an array of bytes that represents the Oracle INTERVAL YEAR TO MONTH in Oracle internal format.


Declaration
// C#
public byte[] BinData {get;}

Property Value

A byte array that represents an Oracle INTERVAL YEAR TO MONTH in Oracle internal format.


Exceptions

OracleNullValueException - The current instance has a null value.


IsNull

This property indicates whether the value has a null value.


Declaration
// C#
public bool IsNull {get;}

Property Value

Returns true if value has a null value; otherwise, returns false.


Months

This property gets the months component of an OracleIntervalYM.


Declaration
// C#
public int Months {get;}

Property Value

An int representing the months component.


Exceptions

OracleNullValueException - The current instance has a null value.


TotalYears

This property returns the total number, in years, that represents the period of time in the current OracleIntervalYM structure.


Declaration
// C#
public double TotalYears {get;}

Property Value

A double representing the total number of years.


Exceptions

OracleNullValueException - The current instance has a null value.


Value

This property gets the total number of months that is stored in the OracleIntervalYM structure.


Declaration
// C#
public long Value {get;}

Property Value

The total number of months representing the time interval.


Exceptions

OracleNullValueException - The current instance has a null value.


Years

This property gets the years component of an OracleIntervalYM.


Declaration
// C#
public int Years {get;}

Property Value

An int representing the years component.


Exceptions

OracleNullValueException - The current instance has a null value.

OracleIntervalYM Methods

The OracleIntervalYM methods are listed in Table 5-73.

Table 5-73 OracleIntervalYM Methods

Methods Description
CompareTo Compares the current OracleIntervalYM instance to the supplied object, and returns an integer that represents their relative values
Equals Determines whether the specified object has the same time interval as the current instance (Overloaded)
GetHashCode Returns a hash code for the OracleIntervalYM instance
GetType Inherited from Object
ToString Converts the current OracleIntervalYM structure to a string


CompareTo

This method compares the current OracleIntervalYM instance to the supplied object, and returns an integer that represents their relative values.


Declaration
// C#
public int CompareTo(object obj);

Parameters

Return Value

The method returns a number:

Less than zero: if the current OracleIntervalYM represents a shorter time interval than obj.

Zero: if the current OracleIntervalYM and obj represent the same time interval.

Greater than zero: if the current OracleIntervalYM represents a longer time interval than obj.


Implements

IComparable


Exceptions

ArgumentException - The obj parameter is not of type OracleIntervalYM.


Remarks

The following rules apply to the behavior of this method.


Equals

Overrides Object

This method determines whether the specified object has the same time interval as the current instance.


Declaration
// C#
public override bool Equals(object obj);

Parameters

Return Value

Returns true if the specified object instance is of type OracleIntervalYM and has the same time interval; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GetHashCode

Overrides Object

This method returns a hash code for the OracleIntervalYM instance.


Declaration
// C#
public override int GetHashCode();

Return Value

An int representing a hash code.


ToString

Overrides Object

This method converts the current OracleIntervalYM structure to a string.


Declaration
// C#
public override string ToString();

Return Value

A string that represents the current OracleIntervalYM structure.


Remarks

If the current instance has a null value, the returned string contain "null".


OracleString Structure

The OracleString structure represents a variable-length stream of characters to be stored in or retrieved from a database.


Class Inheritance

Object

  ValueType

    OracleString


Declaration
// C#
public struct OracleString : IComparable

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.


Example
// C#
// Illustrates the usage of OracleString

// bytes1 is non-Unicode encoded byte array = AAAAA
// bytes2 is Unicode encoded byte array = aa

byte[] bytes1 = new byte[] {65,65,65,65,65};
byte[] bytes2 = new byte[] {97,0,97,0};

// set str1 = AAA
// set str2 = a
OracleString str1 = new OracleString(bytes1, 0, 3, false, true);
OracleString str2 = new OracleString(bytes2, 2, 2, true, true);

// Display the constructed strings
Console.WriteLine("String str1 = " + str1.Value  +
 ". Length = " + str1.Length); // Prints String str1 = AAA. Length = 3

 Console.WriteLine("String str2 = " + str2.Value  + 
   ". Length = " + str2.Length); // Prints String str2 = a. Length = 1

while (str1 > str2)
   str2 = OracleString.Concat(str2,"a");

// Display the constructed strings
Console.WriteLine("String str1 = " + str1.Value + 
   ". Length = " + str1.Length); // Prints String str1 = AAA. Length= 3
Console.WriteLine("String str2 = " + str2.Value + 
   ". Length = " + str2.Length); // Prints String str2 = aaa. Length= 3


Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

OracleString Members

OracleString members are listed in the following tables:


OracleString Constructors

OracleString constructors are listed in Table 5-74

Table 5-74 OracleString Constructors

Constructor Description
OracleString Constructors Instantiates a new instance of OracleString structure (Overloaded)


OracleString Static Fields

The OracleString static fields are listed in Table 5-75.

Table 5-75 OracleString Static Fields

Field Description
Null Represents a null value that can be assigned to an instance of the OracleString structure


OracleString Static Methods

The OracleString static methods are listed in Table 5-76.

Table 5-76 OracleString Static Methods

Methods Description
Concat Concatenates two OracleString instances and returns a new OracleString instance that represents the result
Equals Determines if two OracleString values are equal (Overloaded)
GreaterThan Determines whether the first of two OracleString values is greater than the second
GreaterThanOrEqual Determines whether the first of two OracleString values is greater than or equal to the second
LessThan Determines whether the first of two OracleString values is less than the second
LessThanOrEqual Determines whether the first of two OracleString values is less than or equal to the second
NotEquals Determines whether two OracleString values are not equal


OracleString Static Operators

The OracleString static operators are listed in Table 5-77.

Table 5-77 OracleString Static Operators

Operator Description
operator + Concatenates two OracleString values
operator == Determines if two OracleString values are equal
operator > Determines if the first of two OracleString values is greater than the second
operator >= Determines if the first of two OracleString values is greater than or equal to the second
operator != Determines if the two OracleString values are not equal
operator < Determines if the first of two OracleString values is less than the second
operator <= Determines if two OracleString values are not equal


OracleString Type Conversions

The OracleString type conversions are listed in Table 5-78.

Table 5-78 OracleString Type Conversions

Operator Description
explicit operator string Converts the supplied OracleString to a string instance
implicit operator OracleString Converts the supplied string to an OracleString instance


OracleString Properties

The OracleString properties are listed in Table 5-79.

Table 5-79 OracleString Properties

Properties Description
IsCaseIgnored Indicates whether case should be ignored when performing string comparison
IsNull Indicates whether the current instance has a null value
Item Obtains the particular character in an OracleString using an index.
Length Returns the length of the OracleString


OracleString Methods

The OracleString methods are listed in Table 5-80.

Table 5-80 OracleString Methods

Methods Description
Clone Returns a copy of the current OracleString instance
CompareTo Compares the current OracleString instance to the supplied object, and returns an integer that represents their relative values
Equals Determines whether an object has the same string value as the current OracleString structure (Overloaded)
GetHashCode Returns a hash code for the OracleString instance
GetNonUnicodeBytes Returns an array of bytes, containing the contents of the OracleString, in the client character set format
GetType Inherited from Object
GetUnicodeBytes Returns an array of bytes, containing the contents of the OracleString, in Unicode format
ToString Converts the current OracleString instance to a string

OracleString Constructors

The OracleString constructors create new instances of the OracleString structure.


Overload List:

OracleString(string)

This constructor creates a new instance of the OracleString structure and sets its value using a string.


Declaration
// C#
public OracleString(string data);

Parameters

OracleString(string, bool)

This constructor creates a new instance of the OracleString structure and sets its value using a string and specifies if case is ignored in comparison.


Declaration
// C#
public OracleString(string data, bool isCaseIgnored);

Parameters

OracleString(byte [ ], bool)

This constructor creates a new instance of the OracleString structure and sets its value using a byte array and specifies if the supplied byte array is Unicode encoded.


Declaration
// C#
public OracleString(byte[] data, bool fUnicode);

Parameters

Exceptions

ArgumentNullException - The data parameter is null.


OracleString(byte [ ], bool, bool)

This constructor creates a new instance of the OracleString structure and sets its value using a byte array and specifies the following: if the supplied byte array is Unicode encoded and if case is ignored in comparison.


Declaration
// C#
public OracleString(byte[] data, bool fUnicode, bool isCaseIgnored);

Parameters

Exceptions

ArgumentNullException - The data parameter is null.


OracleString(byte [ ], int, int, bool)

This constructor creates a new instance of the OracleString structure and sets its value using a byte array, and specifies the following: the starting index in the byte array, the number of bytes to copy from the byte array, and if the supplied byte array is Unicode encoded.


Declaration
// C#
public OracleString(byte[] data, int index, int count, bool fUnicode);

Parameters

Exceptions

ArgumentNullException - The data parameter is null.

ArgumentOutOfRangeException - The count parameter is less than zero.

IndexOutOfRangeException - The index parameter is greater than or equal to the length of data or less than zero.


OracleString(byte [ ], int, int, bool, bool)

This constructor creates a new instance of the OracleString structure and sets its value using a byte array, and specifies the following: the starting index in the byte array, the number of bytes to copy from the byte array, if the supplied byte array is Unicode encoded, and if case is ignored in comparison.


Declaration
// C#
public OracleString(byte[] data, int index, int count, bool fUnicode,
  bool isCaseIgnored);

Parameters

Exceptions

ArgumentNullException - The data parameter is null.

ArgumentOutOfRangeException - The count parameter is less than zero.

IndexOutOfRangeException - The index parameter is greater than or equal to the length of data or less than zero.

OracleString Static Fields

The OracleString static fields are listed in Table 5-81.

Table 5-81 OracleString Static Fields

Field Description
Null Represents a null value that can be assigned to an instance of the OracleString structure


Null

This static field represents a null value that can be assigned to an instance of the OracleString structure.


Declaration
// C#
public static readonly OracleString Null;

OracleString Static Methods

The OracleString static methods are listed in Table 5-82.

Table 5-82 OracleString Static Methods

Methods Description
Concat Concatenates two OracleString instances and returns a new OracleString instance that represents the result
Equals Determines if two OracleString values are equal (Overloaded)
GreaterThan Determines whether the first of two OracleString values is greater than the second
GreaterThanOrEqual Determines whether the first of two OracleString values is greater than or equal to the second
LessThan Determines whether the first of two OracleString values is less than the second
LessThanOrEqual Determines whether the first of two OracleString values is less than or equal to the second
NotEquals Determines whether two OracleString values are not equal


Concat

This static method concatenates two OracleString instances and returns a new OracleString instance that represents the result.


Declaration
// C#
public static OracleString Concat(OracleString str1, OracleString str2);

Parameters

Return Value

An OracleString.


Remarks

If either argument has a null value, the returned OracleString structure has a null value.


Equals

Overloads Object

This static method determines whether the two OracleStrings being compared are equal.


Declaration
// C#
public static bool Equals(OracleString str1, OracleString str2);

Parameters

Return Value

Returns true if the two OracleStrings being compared are equal; returns false otherwise.


Remarks

The following rules apply to the behavior of this method.


GreaterThan

This static method determines whether the first of two OracleString values is greater than the second.


Declaration
// C#
public static bool GreaterThan(OracleString str1, OracleString str2);

Parameters

Return Value

Returns true if the first of two OracleStrings is greater than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThanOrEqual

This static method determines whether the first of two OracleString values is greater than or equal to the second.


Declaration
// C#
public static bool GreaterThanOrEqual(OracleString str1, OracleString str2);

Parameters

Return Value

Returns true if the first of two OracleStrings is greater than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


LessThan

This static method determines whether the first of two OracleString values is less than the second.


Declaration
// C#
public static bool LessThan(OracleString str1, OracleString str2);

Parameters

Return Value

Returns true if the first is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


LessThanOrEqual

This static method determines whether the first of two OracleString values is less than or equal to the second.


Declaration
// C#
public static bool LessThanOrEqual(OracleString str1, OracleString str2);

Parameters

Return Value

Returns true if the first is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


NotEquals

This static method determines whether two OracleString values are not equal.


Declaration
// C#
public static bool NotEquals(OracleString str1, OracleString str2);

Parameters

Return Value

Returns true if the two OracleString instances are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.

OracleString Static Operators

The OracleString static operators are listed in Table 5-83.

Table 5-83 OracleString Static Operators

Operator Description
operator + Concatenates two OracleString values
operator == Determines if two OracleString values are equal
operator > Determines if the first of two OracleString values is greater than the second
operator >= Determines if the first of two OracleString values is greater than or equal to the second
operator != Determines if the two OracleString values are not equal
operator < Determines if the first of two OracleString values is less than the second
operator <= Determines if two OracleString values are not equal


operator +

This static operator concatenates two OracleString values.


Declaration
// C#
public static OracleString operator + (OracleString value1,  OracleString value2);

Parameters

Return Value

An OracleString.


Remarks

If either argument has a null value, the returned OracleString structure has a null value.


operator ==

This static operator determines if two OracleString values are equal.


Declaration
// C#
public static bool operator == (OracleString value1, OracleString value2);

Parameters

Return Value

Returns true if two OracleString values are equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator >

This static operator determines if the first of two OracleString values is greater than the second.


Declaration
// C#
public static bool operator > (OracleString value1, OracleString value2);

Parameters

Return Value

Returns true if the first of two OracleString values is greater than the second; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


operator >=

This static operator determines if the first of two OracleString values is greater than or equal to the second.


Declaration
// C#
public static bool operator >= (OracleString value1, OracleString value2);

Parameters

Return Value

Returns true if the first of two OracleString values is greater than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator !=

This static operator determines if two OracleString values are not equal.


Declaration
// C#
public static bool operator != (OracleString value1, OracleString value2);

Parameters

Return Value

Returns true if two OracleString values are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <

This static operator determines if the first of two OracleStrings is less than the second.


Declaration
// C#
public static bool operator < (OracleString value1, OracleString value2);

Parameters

Return Value

Returns true if the first of two OracleStrings is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <=

This static operator determines if the first of two OracleString values is less than or equal to the second.


Declaration
// C#
public static bool operator <= (OracleString value1, OracleString value1);

Parameters

Return Value

Returns true if the first of two OracleString values is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.

OracleString Type Conversions

The OracleString type conversions are listed in Table 5-84.

Table 5-84 OracleString Type Conversions

Operator Description
explicit operator string Converts the supplied OracleString to a string instance
implicit operator OracleString Converts the supplied string to an OracleString instance


explicit operator string

This type conversion operator converts the supplied OracleString to a string.


Declaration
//C#
public static explicit operator string (OracleString value1);

Parameters

Return Value

string


Exceptions

OracleNullValueException - The OracleString structure has a null value.


implicit operator OracleString

This type conversion operator converts the supplied string to an OracleString.


Declaration
// C#
public static implicit operator OracleString (string value1);

Parameters

Return Value

An OracleString.

OracleString Properties

The OracleString properties are listed in Table 5-85.

Table 5-85 OracleString Properties

Properties Description
IsCaseIgnored Indicates whether case should be ignored when performing string comparison
IsNull Indicates whether the current instance has a null value
Item Obtains the particular character in an OracleString using an index.
Length Returns the length of the OracleString


IsCaseIgnored

This property indicates whether case should be ignored when performing string comparison.


Declaration
//C#
public bool IsCaseIgnored {get;set;}

Property Value

Returns true if string comparison must ignore case; otherwise false.


Remarks

Default value is true.


Example
// C#
OracleString str1 = new OracleString("aAaAa");
OracleString str2 = new OracleString("AaAaA");

str1.IsCaseIgnored = true;
str2.IsCaseIgnored = true;

Console.WriteLine(str1.CompareTo(str2)); // Prints 0

// Note that IsCaseIgnored must be set to false for both OracleStrings
// otherwise an exception is thrown

str1.IsCaseIgnored = false;
str2.IsCaseIgnored = false;

Console.WriteLine(str1.CompareTo(str2)); // Prints non zero value


IsNull

This property indicates whether the current instance contains a null value.


Declaration
// C#
public bool IsNull {get;}

Property Value

Returns true if the current instance contains has a null value; otherwise, returns false.


Item

This property obtains the particular character in an OracleString using an index.


Declaration
// C#
public char Item {get;}

Property Value

A char value.


Exceptions

OracleNullValueException - The current instance has a null value.


Length

This property returns the length of the OracleString.


Declaration
// C#
public int Length {get;}

Property Value

A int value.


Exceptions

OracleNullValueException - The current instance has a null value.

OracleString Methods

The OracleString methods are listed in Table 5-86.

Table 5-86 OracleString Methods

Methods Description
Clone Returns a copy of the current OracleString instance
CompareTo Compares the current OracleString instance to the supplied object, and returns an integer that represents their relative values
Equals Determines whether an object has the same string value as the current OracleString structure (Overloaded)
GetHashCode Returns a hash code for the OracleString instance
GetNonUnicodeBytes Returns an array of bytes, containing the contents of the OracleString, in the client character set format
GetType Inherited from Object
GetUnicodeBytes Returns an array of bytes, containing the contents of the OracleString, in Unicode format
ToString Converts the current OracleString instance to a string


Clone

This method creates a copy of an OracleString instance.


Declaration
// C#
public OracleString Clone();

Return Value

An OracleString structure.


Remarks

The cloned object has the same property values as that of the object being cloned.


Example
// C#
...
OracleString str_cloned = str.Clone();
...

CompareTo

This method compares the current OracleString instance to the supplied object, and returns an integer that represents their relative values.


Declaration
// C#
public int CompareTo(object obj);

Parameters

Return Value

The method returns a number that is:


Implements

IComparable


Exceptions

ArgumentException - The obj parameter is not of type OracleString.


Remarks

The following rules apply to the behavior of this method.


Equals

This method determines whether supplied object is an instance of OracleString and has the same values as the current OracleString instance.


Declaration
// C#
public override bool Equals(object obj);

Parameters

Return Value

Returns true if the supplied object is an instance of OracleString and has the same values as the current OracleString instance; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GetHashCode

Overrides Object

This method returns a hash code for the OracleString instance.


Declaration
// C#
public override int GetHashCode();

Return Value

A number that represents the hash code.


GetNonUnicodeBytes

This method returns an array of bytes, containing the contents of the OracleString, in the client character set format.


Declaration
// C#
public byte[] GetNonUnicodeBytes();

Return Value

A byte array that contains the contents of the OracleString in the client character set format.


Remarks

If the current instance has a null value, an OracleNullValueException is thrown.


GetUnicodeBytes

This method returns an array of bytes, containing the contents of the OracleString in Unicode format.


Declaration
// C#
public byte[] GetUnicodeBytes();

Return Value

A byte array that contains the contents of the OracleString in Unicode format.


Remarks

If the current instance has a null value, an OracleNullValueException is thrown.


ToString

Overrides Object

This method converts the current OracleString instance to a string.


Declaration
// C#
public override string ToString();

Return Value

A string.


Remarks

If the current OracleString instance has a null value, the string contains "null".


OracleTimeStamp Structure

The OracleTimeStamp structure represents the Oracle TIMESTAMP datatype to be stored in or retrieved from a database. Each OracleTimeStamp stores the following information: year, month, day, hour, minute, second, and nanosecond.


Class Inheritance

Object

  ValueType

    OracleTimeStamp


Declaration
// C#
public struct OracleTimeStamp : IComparable

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.


Example
// C#
// Illustrates usage of OracleTimeStamp

OracleTimeStamp  tsCurrent1 = OracleTimeStamp.GetSysDate();
OracleTimeStamp  tsCurrent2 = DateTime.Now;

// Calculate the difference between tsCurrent1 and tsCurrent2
OracleIntervalDS idsDiff = tsCurrent2.GetDaysBetween(tsCurrent1);

// Calculate the difference using AddNanoseconds()
int nanoDiff = 0;
while (tsCurrent2 > tsCurrent1)
{
  nanoDiff += 10;
  tsCurrent1 = tsCurrent1.AddNanoseconds(10);
}
Console.WriteLine("idsDiff.Nanoseconds = " + idsDiff.Nanoseconds);
      Console.WriteLine("nanoDiff = " + nanoDiff);


Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

OracleTimeStamp Members

OracleTimeStamp members are listed in the following tables:


OracleTimeStamp Constructors

OracleTimeStamp constructors are listed in Table 5-87

Table 5-87 OracleTimeStamp Constructors

Constructor Description
OracleTimeStamp Constructors Instantiates a new instance of OracleTimeStamp structure (Overloaded)


OracleTimeStamp Static Fields

The OracleTimeStamp static fields are listed in Table 5-88.

Table 5-88 OracleTimeStamp Static Fields

Field Description
MaxValue Represents the maximum valid date for an OracleTimeStamp structure, which is December 31, 9999 23:59:59.999999999
MinValue Represents the minimum valid date for an OracleTimeStamp structure, which is January 1, -4712 0:0:0
Null Represents a null value that can be assigned to an instance of the OracleTimeStamp structure


OracleTimeStamp Static Methods

The OracleTimeStamp static methods are listed in Table 5-89.

Table 5-89 OracleTimeStamp Static Methods

Methods Description
Equals Determines if two OracleTimeStamp values are equal (Overloaded)
GreaterThan Determines if the first of two OracleTimeStamp values is greater than the second
GreaterThanOrEqual Determines if the first of two OracleTimeStamp values is greater than or equal to the second
LessThan Determines if the first of two OracleTimeStamp values is less than the second
LessThanOrEqual Determines if the first of two OracleTimeStamp values is less than or equal to the second
NotEquals Determines if two OracleTimeStamp values are not equal
GetSysDate Gets an OracleTimeStamp structure that represents the current date and time
Parse Gets an OracleTimeStamp structure and sets its value using the supplied string
SetPrecision Returns a new instance of an OracleTimeStamp with the specified fractional second precision


OracleTimeStamp Static Operators

The OracleTimeStamp static operators are listed in Table 5-90.

Table 5-90 OracleTimeStamp Static Operators

Operator Description
operator + Adds the supplied instance value to the supplied OracleTimeStamp and returns a new OracleTimeStamp structure (Overloaded)
operator == Determines if two OracleTimeStamp values are equal
operator > Determines if the first of two OracleTimeStamp values is greater than the second
operator >= Determines if the first of two OracleTimeStamp values is greater than or equal to the second
operator != Determines if the two OracleTimeStamp values are not equal
operator < Determines if the first of two OracleTimeStamp values is less than the second
operator <= Determines if the first of two OracleTimeStamp values is less than or equal to the second
operator - Subtracts the supplied instance value from the supplied OracleTimeStamp and returns a new OracleTimeStamp structure (Overloaded)


OracleTimeStamp Static Type Conversions

The OracleTimeStamp static type conversions are listed in Table 5-91.

Table 5-91 OracleTimeStamp Static Type Conversions

Operator Description
explicit operator OracleTimeStamp Converts an instance value to an OracleTimeStamp structure (Overloaded)
implicit operator OracleTimeStamp Converts an instance value to an OracleTimeStamp structure (Overloaded)
explicit operator DateTime Converts an OracleTimeStamp value to a DateTime structure


OracleTimeStamp Properties

The OracleTimeStamp properties are listed in Table 5-92.

Table 5-92 OracleTimeStamp Properties

Properties Description
BinData Returns an array of bytes that represents an Oracle TIMESTAMP in Oracle internal format
Day Specifies the day component of an OracleTimeStamp
IsNull Indicates whether the OracleTimeStamp instance has a null value
Hour Specifies the hour component of an OracleTimeStamp
Millisecond Specifies the millisecond component of an OracleTimeStamp
Minute Specifies the minute component of an OracleTimeStamp
Month Specifies the month component of an OracleTimeStamp
Nanosecond Specifies the nanosecond component of an OracleTimeStamp
Second Specifies the second component of an OracleTimeStamp
Value Specifies the date and time that is stored in the OracleTimeStamp structure
Year Specifies the year component of an OracleTimeStamp


OracleTimeStamp Methods

The OracleTimeStamp methods are listed in Table 5-93.

Table 5-93 OracleTimeStamp Methods

Methods Description
AddDays Adds the supplied number of days to the current instance
AddHours Adds the supplied number of hours to the current instance
AddMilliseconds Adds the supplied number of milliseconds to the current instance
AddMinutes Adds the supplied number of minutes to the current instance
AddMonths Adds the supplied number of months to the current instance
AddNanoseconds Adds the supplied number of nanoseconds to the current instance
AddSeconds Adds the supplied number of seconds to the current instance
AddYears Adds the supplied number of years to the current instance
CompareTo Compares the current OracleTimeStamp instance to an object, and returns an integer that represents their relative values
Equals Determines whether an object has the same date and time as the current OracleTimeStamp instance (Overloaded)
GetHashCode Returns a hash code for the OracleTimeStamp instance
GetDaysBetween Subtracts an OracleTimeStamp value from the current instance and returns an OracleIntervalDS that represents the time difference between the supplied OracleTimeStamp and the current instance
GetYearsBetween Subtracts value1 from the current instance and returns an OracleIntervalYM that represents the difference between value1 and the current instance using OracleIntervalYM
GetType Inherited from Object
ToOracleDate Converts the current OracleTimeStamp structure to an OracleDate structure
ToOracleTimeStampLTZ Converts the current OracleTimeStamp structure to an OracleTimeStampLTZ structure
ToOracleTimeStampTZ Converts the current OracleTimeStamp structure to an OracleTimeStampTZ structure
ToString Converts the current OracleTimeStamp structure to a string

OracleTimeStamp Constructors

The OracleTimeStamp constructors create new instances of the OracleTimeStamp structure.


Overload List:

OracleTimeStamp(DateTime)

This constructor creates a new instance of the OracleTimeStamp structure and sets its value for date and time using the supplied DateTime value.


Declaration
// C#
public OracleTimeStamp (DateTime dt);

Parameters

Exceptions

ArgumentException - The dt parameter cannot be used to construct a valid OracleTimeStamp.


OracleTimeStamp(string)

This constructor creates a new instance of the OracleTimeStamp structure and sets its value using the supplied string.


Declaration
// C#
public OracleTimeStamp (string tsStr);

Parameters

Exceptions

ArgumentException - The tsStr value is an invalid string representation of an Oracle TIMESTAMP or the supplied tsStr is not in the timestamp format specified by the OracleGlobalization.TimeStampFormat property of the thread, which represents Oracle's NLS_TIMESTAMP_FORMAT parameter.

ArgumentNullException - The tsStr value is null.


Remarks

The names and abbreviations used for months and days are in the language specified by the DateLanguage and Calendar properties of the thread's OracleGlobalization object. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.


Example
// C#
// Set the nls_timestamp_format for the OracleTimeStamp(string) constructor
OracleGlobalization og = OracleGlobalization.GetClientInfo();
og.TimeStampFormat   = "DD-MON-YYYY HH:MI:SS.FF AM";
OracleGlobalization.SetThreadInfo(og);

// construct OracleTimeStamp from a string using the format specified.

OracleTimeStamp ts = new OracleTimeStamp("11-NOV-1999 11:02:33.444 AM");

// Set the nls_timestamp_format for the ToString() method
og.TimeStampFormat = "YYYY-MON-DD HH:MI:SS.FF AM";
OracleGlobalization.SetThreadInfo(og);

Console.WriteLine(ts.ToString());
// Prints "1999-NOV-11 11:02:33.444000000 AM"


OracleTimeStamp(int, int, int)

This constructor creates a new instance of the OracleTimeStamp structure and sets its value for date using year, month, and day.


Declaration
// C#
public OracleTimeStamp(int year, int month, int day);

Parameters

Exceptions

ArgumentOutOfRangeException - The argument value for one or more of the parameters is out of the specified range.

ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleTimeStamp (that is, the day is out of range for the month).


OracleTimeStamp(int, int, int, int, int, int)

This constructor creates a new instance of the OracleTimeStamp structure and sets its value for date and time using year, month, day, hour, minute, and second.


Declaration
// C#
public OracleTimeStamp (int year, int month, int day, int hour, int minute, int second);

Parameters

Exceptions

ArgumentOutOfRangeException - The argument value for one or more of the parameters is out of the specified range.

ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleTimeStamp (that is, the day is out of range for the month).


OracleTimeStamp(int, int, int, int, int, int, double)

This constructor creates a new instance of the OracleTimeStamp structure and sets its value for date and time using year, month, day, hour, minute, second, and millisecond.


Declaration
// C#
public OracleTimeStamp(int year, int month, int day, int hour, int minute,
 int second, double millisecond);

Parameters

Exceptions

ArgumentOutOfRangeException - The argument value for one or more of the parameters is out of the specified range.

ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleTimeStamp (that is, the day is out of range for the month).


OracleTimeStamp(int, int, int, int, int, int, int)

This constructor creates a new instance of the OracleTimeStamp structure and sets its value for date and time using year, month, day, hour, minute, second, and nanosecond.


Declaration
// C#
public OracleTimeStamp (int year, int month, int day, int hour, int minute, int second, int nanosecond);

Parameters

Exceptions

ArgumentOutOfRangeException - The argument value for one or more of the parameters is out of the specified range.

ArgumentException - The argument values of the parameters cannot be used to construct a valid OracleTimeStamp (that is, the day is out of range for the month).


OracleTimeStamp(byte [ ])

This constructor creates a new instance of the OracleTimeStamp structure and sets its value to the provided byte array, which is in the internal Oracle TIMESTAMP format.


Declaration
// C#
public OracleTimeStamp (byte[] bytes);

Parameters

Exceptions

ArgumentException - bytes is not in an internal Oracle TIMESTAMP format or bytes is not a valid Oracle TIMESTAMP.

ArgumentNullException - bytes is null.

OracleTimeStamp Static Fields

The OracleTimeStamp static fields are listed in Table 5-94.

Table 5-94 OracleTimeStamp Static Fields

Field Description
MaxValue Represents the maximum valid date for an OracleTimeStamp structure, which is December 31, 9999 23:59:59.999999999
MinValue Represents the minimum valid date for an OracleTimeStamp structure, which is January 1, -4712 0:0:0
Null Represents a null value that can be assigned to an instance of the OracleTimeStamp structure


MaxValue

This static field represents the maximum valid date and time for an OracleTimeStamp structure, which is December 31, 9999 23:59:59.999999999.


Declaration
// C#
public static readonly OraTimestamp MaxValue;

MinValue

This static field represents the minimum valid date and time for an OracleTimeStamp structure, which is January 1, -4712 0:0:0.


Declaration
// C#
public static readonly OracleTimeStamp MinValue;

Null

This static field represents a null value that can be assigned to an instance of the OracleTimeStamp structure.


Declaration
// C#
public static readonly OracleTimeStamp Null;

OracleTimeStamp Static Methods

The OracleTimeStamp static methods are listed in Table 5-95.

Table 5-95 OracleTimeStamp Static Methods

Methods Description
Equals Determines if two OracleTimeStamp values are equal (Overloaded)
GreaterThan Determines if the first of two OracleTimeStamp values is greater than the second
GreaterThanOrEqual Determines if the first of two OracleTimeStamp values is greater than or equal to the second
LessThan Determines if the first of two OracleTimeStamp values is less than the second
LessThanOrEqual Determines if the first of two OracleTimeStamp values is less than or equal to the second
NotEquals Determines if two OracleTimeStamp values are not equal
GetSysDate Gets an OracleTimeStamp structure that represents the current date and time
Parse Gets an OracleTimeStamp structure and sets its value using the supplied string
SetPrecision Returns a new instance of an OracleTimeStamp with the specified fractional second precision


Equals

This static method determines if two OracleTimeStamp values are equal.


Declaration
// C#
public static bool Equals(OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if two OracleTimeStamp values are equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThan

This static method determines if the first of two OracleTimeStamp values is greater than the second.


Declaration
// C#
public static bool GreaterThan(OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if the first of two OracleTimeStamp values is greater than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GreaterThanOrEqual

This static method determines if the first of two OracleTimeStamp values is greater than or equal to the second.


Declaration
// C#
public static bool GreaterThanOrEqual(OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if the first of two OracleTimeStamp values is greater than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


LessThan

This static method determines if the first of two OracleTimeStamp values is less than the second.


Declaration
// C#
public static bool LessThan(OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if the first of two OracleTimeStamp values is less than the second. Returns false otherwise.


Remarks

The following rules apply to the behavior of this method.


LessThanOrEqual

This static method determines if the first of two OracleTimeStamp values is less than or equal to the second.


Declaration
// C#
public static bool LessThanOrEqual(OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if the first of two OracleTimeStamp values is less than or equal to the second. Returns false otherwise.


Remarks

The following rules apply to the behavior of this method.


NotEquals

This static method determines if two OracleTimeStamp values are not equal.


Declaration
// C#
public static bool NotEquals(OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if two OracleTimeStamp values are not equal. Returns false otherwise.


Remarks

The following rules apply to the behavior of this method.


GetSysDate

This static method gets an OracleTimeStamp structure that represents the current date and time.


Declaration
// C#
public static OracleTimeStamp GetSysDate();

Return Value

An OracleTimeStamp structure that represents the current date and time.


Parse

This static method gets an OracleTimeStamp structure and sets its value using the supplied string.


Declaration
// C#
public static OracleTimeStamp Parse(string datetime);

Parameters

Return Value

An OracleTimeStamp structure.


Exceptions

ArgumentException - The tsStr is an invalid string representation of an Oracle TIMESTAMP or the supplied tsStr is not in the timestamp format specified by the OracleGlobalization.TimeStampFormat property of the thread, which represents Oracle's NLS_TIMESTAMP_FORMAT parameter.

ArgumentNullException - The tsStr value is null.


Remarks

The names and abbreviations used for months and days are in the language specified by the DateLanguage and Calendar properties of the thread's OracleGlobalization object. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.


Example
// C#
// Set the nls_timestamp_format for the Parse() method
OracleGlobalization og = OracleGlobalization.GetClientInfo();
og.TimeStampFormat   = "DD-MON-YYYY HH:MI:SS.FF AM";
OracleGlobalization.SetThreadInfo(og);

// construct OracleTimeStamp from a string using the format specified.

OracleTimeStamp ts = OracleTimeStamp.Parse("11-NOV-1999 11:02:33.444 AM");

// Set the nls_timestamp_format for the ToString() method
og.TimeStampFormat = "YYYY-MON-DD HH:MI:SS.FF AM";
OracleGlobalization.SetThreadInfo(og);

Console.WriteLine(ts.ToString());
// Prints "1999-NOV-11 11:02:33.444000000 AM"


SetPrecision

This static method returns a new instance of an OracleTimeStamp with the specified fractional second precision.


Declaration
// C#
public static OracleTimeStamp SetPrecision(OracleTimeStamp value1, int fracSecPrecision);

Parameters

Return Value

An OracleTimeStamp structure with the specified fractional second precision.


Exceptions

ArgumentOutOfRangeException - fracSecPrecision is out of the specified range.


Remarks

The value specified in the supplied fracSecPrecision is used to perform a rounding off operation on the supplied OracleTimeStamp value. Depending on this value, 0 or more trailing zeros are displayed in the string returned by ToString().


Example

The OracleTimeStamp with a value of "December 31, 9999 23:59:59.99" results in the string "December 31, 9999 23:59:59.99000" when SetPrecision() is called with the fractional second precision set to 5.

OracleTimeStamp Static Operators

The OracleTimeStamp static operators are listed in Table 5-96.

Table 5-96 OracleTimeStamp Static Operators

Operator Description
operator + Adds the supplied instance value to the supplied OracleTimeStamp and returns a new OracleTimeStamp structure (Overloaded)
operator == Determines if two OracleTimeStamp values are equal
operator > Determines if the first of two OracleTimeStamp values is greater than the second
operator >= Determines if the first of two OracleTimeStamp values is greater than or equal to the second
operator != Determines if the two OracleTimeStamp values are not equal
operator < Determines if the first of two OracleTimeStamp values is less than the second
operator <= Determines if the first of two OracleTimeStamp values is less than or equal to the second
operator - Subtracts the supplied instance value from the supplied OracleTimeStamp and returns a new OracleTimeStamp structure (Overloaded)

operator +

operator+ adds the supplied object to the OracleTimeStamp and returns a new OracleTimeStamp structure.


Overload List:

operator + (OracleTimeStamp, OracleIntervalDS)

This static operator adds the supplied OracleIntervalDS to the OracleTimeStamp and returns a new OracleTimeStamp structure.


Declaration
// C#
public static operator + (OracleTimeStamp value1, OracleIntervalDS value2);

Parameters

Return Value

An OracleTimeStamp.


Remarks

If either parameter has a null value, the returned OracleTimeStamp has a null value.


operator + (OracleTimeStamp, OracleIntervalYM)

This static operator adds the supplied OracleIntervalYM to the supplied OracleTimeStamp and returns a new OracleTimeStamp structure.


Declaration
// C#
public static operator + (OracleTimeStamp value1, OracleIntervalYM value2);

Parameters

Return Value

An OracleTimeStamp.


Remarks

If either parameter has a null value, the returned OracleTimeStamp has a null value.


operator + (OracleTimeStamp, TimeSpan)

This static operator adds the supplied TimeSpan to the supplied OracleTimeStamp and returns a new OracleTimeStamp structure.


Declaration
// C#
public static operator + (OracleTimeStamp value1, TimeSpan value2);

Parameters

Return Value

An OracleTimeStamp.


Remarks

If the OracleTimeStamp instance has a null value, the returned OracleTimeStamp has a null value.


operator ==

This static operator determines if two OracleTimeStamp values are equal.


Declaration
// C#
public static bool operator == (OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if they are the same; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator >

This static operator determines if the first of two OracleTimeStamp values is greater than the second.


Declaration
// C#
public static bool operator > (OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if the first OracleTimeStamp value is greater than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator >=

This static operator determines if the first of two OracleTimeStamp values is greater than or equal to the second.


Declaration
// C#
public static bool operator >= (OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if the first OracleTimeStamp is greater than or equal to the second; otherwise returns false.


Remarks

The following rules apply to the behavior of this method.


operator !=

This static operator determines if two OracleTimeStamp values are not equal.


Declaration
// C#
public static bool operator != (OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if two OracleTimeStamp values are not equal; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <

This static operator determines if the first of two OracleTimeStamp values is less than the second.


Declaration
// C#
public static bool operator < (OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if the first OracleTimeStamp is less than the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


operator <=

This static operator determines if the first of two OracleTimeStamp values is less than or equal to the second.


Declaration
// C#
public static bool operator <= (OracleTimeStamp value1, OracleTimeStamp value2);

Parameters

Return Value

Returns true if the first OracleTimeStamp is less than or equal to the second; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.

operator -

operator- subtracts the supplied value, from the supplied OracleTimeStamp value, and returns a new OracleTimeStamp structure.


Overload List:

operator - (OracleTimeStamp, OracleIntervalDS)

This static operator subtracts the supplied OracleIntervalDS value, from the supplied OracleTimeStamp value, and return a new OracleTimeStamp structure.


Declaration
// C#
public static operator - (OracleTimeStamp value1, OracleIntervalDS value2);

Parameters

Return Value

An OracleTimeStamp structure.


Remarks

If either parameter has a null value, the returned OracleTimeStamp has a null value.


operator - (OracleTimeStamp, OracleIntervalYM)

This static operator subtracts the supplied OracleIntervalYM value, from the supplied OracleTimeStamp value, and returns a new OracleTimeStamp structure.


Declaration
// C#
public static operator - (OracleTimeStamp value1, OracleIntervalYM value2);

Parameters

Return Value

An OracleTimeStamp structure.


Remarks

If either parameter has a null value, the returned OracleTimeStamp has a null value.


operator - (OracleTimeStamp, TimeSpan)

This static operator subtracts the supplied TimeSpan value, from the supplied OracleTimeStamp value, and returns a new OracleTimeStamp structure.


Declaration
// C#
public static operator - (OracleTimeStamp value1, TimeSpan value2);

Parameters

Return Value

An OracleTimeStamp structure.


Remarks

If the OracleTimeStamp instance has a null value, the returned OracleTimeStamp structure has a null value.

OracleTimeStamp Static Type Conversions

The OracleTimeStamp static type conversions are listed in Table 5-97.

Table 5-97 OracleTimeStamp Static Type Conversions

Operator Description
explicit operator OracleTimeStamp Converts an instance value to an OracleTimeStamp structure (Overloaded)
implicit operator OracleTimeStamp Converts an instance value to an OracleTimeStamp structure (Overloaded)
explicit operator DateTime Converts an OracleTimeStamp value to a DateTime structure

explicit operator OracleTimeStamp

explicit operator OracleTimeStamp converts the supplied value to an OracleTimeStamp structure


Overload List:

explicit operator OracleTimeStamp(OracleTimeStampLTZ)

This static type conversion operator converts an OracleTimeStampLTZ value to an OracleTimeStamp structure.


Declaration
// C#
public static explicit operator OracleTimeStamp(OracleTimeStampLTZ value1);

Parameters

Return Value

The returned OracleTimeStamp contains the date and time of the OracleTimeStampLTZ structure.


Remarks

If the OracleTimeStampLTZ structure has a null value, the returned OracleTimeStamp structure also has a null value.


explicit operator OracleTimeStamp(OracleTimeStampTZ)

This static type conversion operator converts an OracleTimeStampTZ value to an OracleTimeStamp structure.


Declaration
// C#
public static explicit operator OracleTimeStamp(OracleTimeStampTZ value1);

Parameters

Return Value

The returned OracleTimeStamp contains the date and time information from value1, but the time zone information from value1 is truncated.


Remarks

If the OracleTimeStampTZ structure has a null value, the returned OracleTimeStamp structure also has a null value.


explicit operator OracleTimeStamp(string)

This static type conversion operator converts the supplied string to an OracleTimeStamp structure.


Declaration
// C#
public static explicit operator OracleTimeStamp(string tsStr);

Parameters

Return Value

A OracleTimeStamp.


Exceptions

ArgumentException - The tsStr is an invalid string representation of an Oracle TIMESTAMP or the tsStr is not in the timestamp format specified by the thread's OracleGlobalization.TimeStampFormat property, which represents Oracle's NLS_TIMESTAMP_FORMAT parameter.


Remarks

The names and abbreviations used for months and days are in the language specified by the DateLanguage and Calendar properties of the thread's OracleGlobalization object. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.


Example
// C#
// Set the nls_timestamp_format for the explicit operator // OracleTimeStamp(string)
OracleGlobalization og = OracleGlobalization.GetClientInfo();
og.TimeStampFormat   = "DD-MON-YYYY HH:MI:SS.FF AM";
OracleGlobalization.SetThreadInfo(og);

// construct OracleTimeStamp from a string using the format specified.

OracleTimeStamp ts = new OracleTimeStamp("11-NOV-1999 11:02:33.444 AM");

// Set the nls_timestamp_format for the ToString method
og.TimeStampFormat = "YYYY-MON-DD HH:MI:SS.FF AM";
OracleGlobalization.SetThreadInfo(og);

Console.WriteLine(ts.ToString());
// Prints "1999-NOV-11 11:02:33.444000000 AM"

implicit operator OracleTimeStamp

This static type conversion operator converts a value to an OracleTimeStamp structure.


Overload List:

implicit operator OracleTimeStamp(OracleDate)

This static type conversion operator converts an OracleDate value to an OracleTimeStamp structure.


Declaration
// C#
public static implicit operator OracleTimeStamp (OracleDate value1);

Parameters

Return Value

An OracleTimeStamp structure that contains the date and time of the OracleDate structure, value1.


Remarks

If the OracleDate structure has a null value, the returned OracleTimeStamp structure also has a null value.


implicit operator OracleTimeStamp(DateTime)

This static type conversion operator converts a DateTime value to an OracleTimeStamp structure.


Declaration
// C#
public static implicit operator OracleTimeStamp(DateTime value);

Parameters

Return Value

An OracleTimeStamp structure.


explicit operator DateTime

This static type conversion operator converts an OracleTimeStamp value to a DateTime structure.


Declaration
// C#
public static explicit operator DateTime(OracleTimeStamp value1);

Parameters

Return Value

A DateTime containing the date and time in the current instance.


Exceptions

OracleNullValueException - The OracleTimeStamp structure has a null value.


Remarks

The precision of the OracleTimeStamp can be lost during the conversion.

OracleTimeStamp Properties

The OracleTimeStamp properties are listed in Table 5-98.

Table 5-98 OracleTimeStamp Properties

Properties Description
BinData Returns an array of bytes that represents an Oracle TIMESTAMP in Oracle internal format
Day Specifies the day component of an OracleTimeStamp
IsNull Indicates whether the OracleTimeStamp instance has a null value
Hour Specifies the hour component of an OracleTimeStamp
Millisecond Specifies the millisecond component of an OracleTimeStamp
Minute Specifies the minute component of an OracleTimeStamp
Month Specifies the month component of an OracleTimeStamp
Nanosecond Specifies the nanosecond component of an OracleTimeStamp
Second Specifies the second component of an OracleTimeStamp
Value Specifies the date and time that is stored in the OracleTimeStamp structure
Year Specifies the year component of an OracleTimeStamp


BinData

This property returns an array of bytes that represents an Oracle TIMESTAMP in Oracle internal format.


Declaration
// C#
public byte[] BinData {get;}

Property Value

A byte array that represents an Oracle TIMESTAMP in an internal format.


Exceptions

OracleNullValueException - The current instance has a null value.


Day

This property specifies the day component of an OracleTimeStamp.


Declaration
// C#
public int Day{get;}

Property Value

A number that represents the day. Range of Day is (1 to 31).


Exceptions

OracleNullValueException - The current instance has a null value.


IsNull

This property indicates whether the current instance has a null value.


Declaration
// C#
public bool IsNull{get;}

Property Value

Returns true if the current instance has a null value; otherwise, returns false.


Hour

This property specifies the hour component of an OracleTimeStamp.


Declaration
// C#
public int Hour{get;}

Property Value

A number that represents the hour. Range of hour is (0 to 23).


Exceptions

OracleNullValueException - The current instance has a null value.


Millisecond

This property gets the millisecond component of an OracleTimeStamp.


Declaration
// C#
public double Millisecond{get;}

Property Value

A number that represents a millisecond. Range of Millisecond is (0 to 999.999999).


Exceptions

OracleNullValueException - The current instance has a null value.


Minute

This property gets the minute component of an OracleTimeStamp.


Declaration
// C#
public int Minute{get;}

Property Value

A number that represent a minute. Range of Minute is (0 to 59).


Exceptions

OracleNullValueException - The current instance has a null value.


Month

This property gets the month component of an OracleTimeStamp.


Declaration
// C#
public int Month{get;}

Property Value

A number that represents a month. Range of Month is (1 to 12).


Exceptions

OracleNullValueException - The current instance has a null value.


Nanosecond

This property gets the nanosecond component of an OracleTimeStamp.


Declaration
// C#
public int Nanosecond{get;}

Property Value

A number that represents a nanosecond. Range of Nanosecond is (0 to 999999999).


Exceptions

OracleNullValueException - The current instance has a null value.


Second

This property gets the second component of an OracleTimeStamp.


Declaration
// C#
public int Second{get;}

Property Value

A number that represents a second. Range of Second is (0 to 59).


Exceptions

OracleNullValueException - The current instance has a null value.


Value

This property specifies the date and time that is stored in the OracleTimeStamp structure.


Declaration
// C#
public DateTime Value{get;}

Property Value

A DateTime.


Exceptions

OracleNullValueException - The current instance has a null value.


Year

This property gets the year component of an OracleTimeStamp.


Declaration
// C#
public int Year{get;}

Property Value

A number that represents a year. The range of Year is (-4712 to 9999).


Exceptions

OracleNullValueException - The current instance has a null value.

OracleTimeStamp Methods

The OracleTimeStamp methods are listed in Table 5-99.

Table 5-99 OracleTimeStamp Methods

Methods Description
AddDays Adds the supplied number of days to the current instance
AddHours Adds the supplied number of hours to the current instance
AddMilliseconds Adds the supplied number of milliseconds to the current instance
AddMinutes Adds the supplied number of minutes to the current instance
AddMonths Adds the supplied number of months to the current instance
AddNanoseconds Adds the supplied number of nanoseconds to the current instance
AddSeconds Adds the supplied number of seconds to the current instance
AddYears Adds the supplied number of years to the current instance
CompareTo Compares the current OracleTimeStamp instance to an object, and returns an integer that represents their relative values
Equals Determines whether an object has the same date and time as the current OracleTimeStamp instance (Overloaded)
GetHashCode Returns a hash code for the OracleTimeStamp instance
GetDaysBetween Subtracts an OracleTimeStamp value from the current instance and returns an OracleIntervalDS that represents the time difference between the supplied OracleTimeStamp and the current instance
GetYearsBetween Subtracts value1 from the current instance and returns an OracleIntervalYM that represents the difference between value1 and the current instance using OracleIntervalYM
GetType Inherited from Object
ToOracleDate Converts the current OracleTimeStamp structure to an OracleDate structure
ToOracleTimeStampLTZ Converts the current OracleTimeStamp structure to an OracleTimeStampLTZ structure
ToOracleTimeStampTZ Converts the current OracleTimeStamp structure to an OracleTimeStampTZ structure
ToString Converts the current OracleTimeStamp structure to a string


AddDays

This method adds the supplied number of days to the current instance.


Declaration
// C#
public OracleTimeStamp AddDays(double days);

Parameters

Return Value

An OracleTimeStamp.


Exceptions

ArgumentOutofRangeException - The argument value is out of the specified range.

OracleNullValueException - The current instance has a null value.


AddHours

This method adds the supplied number of hours to the current instance.


Declaration
// C#
public OracleTimeStamp AddHours(double hours);

Parameters

Return Value

An OracleTimeStamp.


Exceptions

ArgumentOutofRangeException - The argument value is out of the specified range.

OracleNullValueException - The current instance has a null value.


AddMilliseconds

This method adds the supplied number of milliseconds to the current instance.


Declaration
// C#
public OracleTimeStamp AddMilliseconds(double milliseconds);

Parameters

Return Value

An OracleTimeStamp.


Exceptions

ArgumentOutofRangeException - The argument value is out of the specified range.

OracleNullValueException - The current instance has a null value.


AddMinutes

This method adds the supplied number of minutes to the current instance.


Declaration
// C#
public OracleTimeStamp AddMinutes(double minutes);

Parameters

Return Value

An OracleTimeStamp.


Exceptions

ArgumentOutofRangeException - The argument value is out of the specified range.

OracleNullValueException - The current instance has a null value.


AddMonths

This method adds the supplied number of months to the current instance.


Declaration
// C#
public OracleTimeStamp AddMonths(long months);

Parameters

Return Value

An OracleTimeStamp.


Exceptions

ArgumentOutofRangeException - The argument value is out of the specified range.

OracleNullValueException - The current instance has a null value.


AddNanoseconds

This method adds the supplied number of nanoseconds to the current instance.


Declaration
// C#
public OracleTimeStamp AddNanoseconds(long nanoseconds);

Parameters

Return Value

An OracleTimeStamp.


Exceptions

OracleNullValueException - The current instance has a null value.


AddSeconds

This method adds the supplied number of seconds to the current instance.


Declaration
// C#
public OracleTimeStamp AddSeconds(double seconds);

Parameters

Return Value

An OracleTimeStamp.


Exceptions

ArgumentOutofRangeException - The argument value is out of the specified range.

OracleNullValueException - The current instance has a null value.


AddYears

This method adds the supplied number of years to the current instance.


Declaration
// C#
public OracleTimeStamp AddYears(int years);

Parameters

Return Value

An OracleTimeStamp.


Exceptions

ArgumentOutofRangeException - The argument value is out of the specified range.

OracleNullValueException - The current instance has a null value.


CompareTo

This method compares the current OracleTimeStamp instance to an object, and returns an integer that represents their relative values.


Declaration
// C#
public int CompareTo(object obj);

Parameters

Return Value

The method returns a number that is:

Less than zero: if the current OracleTimeStamp instance value is less than that of obj.

Zero: if the current OracleTimeStamp instance and obj values are equal.

Greater than zero: if the current OracleTimeStamp instance value is greater than that of obj.


Implements

IComparable


Exceptions

ArgumentException - The obj parameter is not of type OracleTimeStamp.


Remarks

The following rules apply to the behavior of this method.


Equals

Overrides Object

This method determines whether an object has the same date and time as the current OracleTimeStamp instance.


Declaration
// C#
public override bool Equals(object obj);

Parameters

Return Value

Returns true if the obj is of type OracleTimeStamp and represents the same date and time; otherwise, returns false.


Remarks

The following rules apply to the behavior of this method.


GetHashCode

Overrides Object

This method returns a hash code for the OracleTimeStamp instance.


Declaration
// C#
public override int GetHashCode();

Return Value

A number that represents the hash code.


GetDaysBetween

This method subtracts an OracleTimeStamp value from the current instance and returns an OracleIntervalDS that represents the time difference between the supplied OracleTimeStamp structure and the current instance.


Declaration
// C#
public OracleIntervalDS GetDaysBetween(OracleTimeStamp value1);

Parameters

Return Value

An OracleIntervalDS that represents the interval between two OracleTimeStamp values.


Remarks

If either the current instance or the parameter has a null value, the returned OracleIntervalDS has a null value.


GetYearsBetween

This method subtracts an OracleTimeStamp value from the current instance and returns an OracleIntervalYM that represents the time difference between the OracleTimeStamp value and the current instance.


Declaration
// C#
public OracleIntervalYM GetYearsBetween(OracleTimeStamp value1);

Parameters

Return Value

An OracleIntervalYM that represents the interval between two OracleTimeStamp values.


Remarks

If either the current instance or the parameter has a null value, the returned OracleIntervalYM has a null value.


ToOracleDate

This method converts the current OracleTimeStamp structure to an OracleDate structure.


Declaration
// C#
public OracleDate ToOracleDate();

Return Value

The returned OracleDate contains the date and time in the current instance.


Remarks

The precision of the OracleTimeStamp value can be lost during the conversion.

If the value of the OracleTimeStamp has a null value, the value of the returned OracleDate structure has a null value.


ToOracleTimeStampLTZ

This method converts the current OracleTimeStamp structure to an OracleTimeStampLTZ structure.


Declaration
// C#
public OracleTimeStampLTZ ToOracleTimeStampLTZ();

Return Value

The returned OracleTimeStampLTZ contains date and time in the current instance.


Remarks

If the value of the current instance has a null value, the value of the returned OracleTimeStampLTZ structure has a null value.


ToOracleTimeStampTZ

This method converts the current OracleTimeStamp structure to an OracleTimeStampTZ structure.


Declaration
// C#
public OracleTimeStampTZ ToOracleTimeStampTZ();

Return Value

The returned OracleTimeStampTZ contains the date and time from the OracleTimeStamp and the time zone from the OracleGlobalization.TimeZone of the thread.


Remarks

If the value of the current instance has a null value, the value of the returned OracleTimeStampTZ structure has a null value.


ToString

Overrides Object

This method converts the current OracleTimeStamp structure to a string.


Declaration
// C#
public override string ToString();

Return Value

A string that represents the same date and time as the current OracleTimeStamp structure.


Remarks

The returned value is a string representation of an OracleTimeStamp in the format specified by the OracleGlobalization.TimeStampFormat property of the thread.

The names and abbreviations used for months and days are in the language specified by the OracleGlobalization's DateLanguage and Calendar properties of the thread. If any of the thread's globalization properties are set to null or an empty string, the client computer's settings are used.


Example
// C#
// Set the nls_timestamp_format for the OracleTimeStamp(string)constructor
OracleGlobalization og = OracleGlobalization.GetClientInfo();
og.TimeStampFormat   = "DD-MON-YYYY HH:MI:SS.FF AM";
OracleGlobalization.SetThreadInfo(og);

// construct OracleTimeStamp from a string using the format specified.

OracleTimeStamp ts = new OracleTimeStamp("11-NOV-1999 11:02:33.444 AM");

// Set the nls_timestamp_format for the ToString() method
og.TimeStampFormat = "YYYY-MON-DD HH:MI:SS.FF AM";
OracleGlobalization.SetThreadInfo(og);

Console.WriteLine(ts.ToString());
// Prints "1999-NOV-11 11:02:33.444000000 AM"


OracleTimeStampLTZ Structure

The OracleTimeStampLTZ structure represents the Oracle TIMESTAMP WITH LOCAL TIME ZONE data type to be stored in or retrieved from a database. Each OracleTimeStampLTZ stores the following information: year, month, day, hour, minute, second, and nanosecond.


Class Inheritance

Object

  ValueType

    OracleTimeStampLTZ


Declaration
// C#
public struct OracleTimeStampLTZ : IComparable

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.


Example