Skip Headers

Oracle® Data Provider for .NET Developer's Guide
Release 9.2.0.4

Part Number B10961-01
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to beginning of chapter Go to next page

Oracle.DataAccess.Types Namespace (ODP.NET Types), 6 of 19


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

See Also:

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

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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

See Also:

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.

See Also:

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.

See Also:

Null

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

Declaration
// C#
public static readonly OracleIntervalYM Null;

See Also:

Zero

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

Declaration
// C#
public static readonly OracleIntervalDS Zero;

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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.

See Also:

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

See Also:

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.

See Also:

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".

See Also:


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2002, 2003 Oracle Corporation.

All Rights Reserved.
Go To Table Of Contents
Contents
Go To Index
Index