Oracle® Data Provider for .NET Developer's Guide 11g Release 2 (11.2.0.3) Part Number E23174-02 |
|
|
PDF · Mobi · ePub |
The OracleIntervalYM
structure represents the Oracle INTERVAL
YEAR
TO
MONTH
data type to be stored in or retrieved from a database. Each OracleIntervalYM
stores a period of time in years and months.
System.Object
System.ValueType
Oracle.DataAccess.Types.OracleIntervalYM
// C# public struct OracleIntervalYM : IComparable
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
// C# using System; using Oracle.DataAccess.Types; class OracleIntervalYMSample { static void Main() { OracleIntervalYM iYMMax = OracleIntervalYM.MaxValue; double totalYears = iYMMax.TotalYears; totalYears -= 1; OracleIntervalYM iYMMax_1 = new OracleIntervalYM(totalYears); // Calculate the difference OracleIntervalYM iYMDiff = iYMMax - iYMMax_1; // Prints "iYMDiff.ToString() = +000000001-00" Console.WriteLine("iYMDiff.ToString() = " + iYMDiff.ToString()); } }
Namespace: Oracle.DataAccess.Types
Assembly: Oracle.DataAccess.dll
ODP.NET Version: ODP.NET for .NET Framework 2.0 or ODP.NET for .NET Framework 4
See Also:
OracleIntervalYM
members are listed in the following tables:
OracleIntervalYM
constructors are listed in Table 14-61
Table 14-61 OracleIntervalYM Constructors
Constructor | Description |
---|---|
Instantiates a new instance of |
OracleIntervalYM Static Fields
The OracleIntervalYM
static fields are listed in Table 14-62.
Table 14-62 OracleIntervalYM Static Fields
Field | Description |
---|---|
Represents the maximum value for an |
|
Represents the minimum value for an |
|
Represents a null value that can be assigned to an |
|
Represents a zero value for an |
OracleIntervalYM Static Methods
The OracleIntervalYM
static methods are listed in Table 14-63.
Table 14-63 OracleIntervalYM Static Methods
Methods | Description |
---|---|
Determines whether or not two |
|
Determines whether or not one |
|
Determines whether or not one |
|
Determines whether or not one |
|
Determines whether or not one |
|
Determines whether two |
|
Returns an |
|
Returns a new instance of an |
OracleIntervalYM Static Operators
The OracleIntervalYM
static operators are listed in Table 14-64.
Table 14-64 OracleIntervalYM Static Operators
Operator | Description |
---|---|
Adds two |
|
Determines whether or not two |
|
Determines whether or not one |
|
Determines whether or not one |
|
Determines whether two |
|
Determines whether or not one |
|
Determines whether or not one |
|
Subtracts one |
|
Negates an |
|
Multiplies an |
|
Divides an |
OracleIntervalYM Type Conversions
The OracleIntervalYM
conversions are listed in Table 14-65.
Table 14-65 OracleIntervalYM Type Conversions
Operator | Description |
---|---|
Converts an |
|
Converts a string to an |
|
Converts the number of months to an |
The OracleIntervalYM
properties are listed in Table 14-66.
Table 14-66 OracleIntervalYM Properties
Properties | Description |
---|---|
Returns an array of bytes that represents the Oracle |
|
Indicates whether or not the current instance has a null value |
|
Gets the months component of an |
|
Returns the total number, in years, that represents the period of time in the current |
|
Specifies the total number of months that is stored in the |
|
Gets the years component of an |
The OracleIntervalYM
methods are listed in Table 14-67.
Table 14-67 OracleIntervalYM Methods
Methods | Description |
---|---|
Compares the current |
|
Determines whether or not the specified |
|
Returns a hash code for the |
|
GetType |
Inherited from |
Converts the current |
The OracleIntervalYM
constructors creates a new instance of the OracleIntervalYM
structure.
This method creates a new instance of the OracleIntervalYM
structure using the supplied total number of months for a period of time.
This method creates a new instance of the OracleIntervalYM
structure and sets its value using the supplied string.
This method creates a new instance of the OracleIntervalYM
structure and sets its value using the total number of years.
This method creates a new instance of the OracleIntervalYM
structure and sets its value using years and months.
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.
This method creates a new instance of the OracleIntervalYM
structure using the supplied total number of months for a period of time.
// C#
public OracleIntervalYM (long totalMonths);
totalMonths
The number of total months for a time interval. Range is -12,000,000,000 < totalMonths
< 12,000,000,000.
ArgumentOutOfRangeException
- The totalMonths
parameter is out of the specified range.
This method creates a new instance of the OracleIntervalYM
structure and sets its value using the supplied string.
// C#
public OracleIntervalYM (string intervalStr);
intervalStr
A string representing the Oracle INTERVAL
YEAR
TO
MONTH
.
The value specified in the supplied intervalStr
must be in Year-Month format.
ArgumentException
- The intervalStr
parameter is not in the valid format or intervalStr
has an invalid value.
ArgumentNullException
- The intervalStr
parameter is null.
"1-2" means 1 year and 2 months.
This method creates a new instance of the OracleIntervalYM
structure and sets its value using the total number of years.
// C#
public OracleIntervalYM (double totalYears);
totalYears
Number of total years. Range is -1,000,000,000 < totalYears
> 1,000,000,000.
ArgumentOutOfRangeException
- The totalYears
parameter is out of the specified range.
ArgumentException
- The totalYears
parameter cannot be used to construct a valid OracleIntervalYM
.
This method creates a new instance of the OracleIntervalYM
structure and sets its value using years and months.
// C# public OracleIntervalYM (int years, int months);
years
Number of years. Range of year is (-999,999,999 to 999,999,999).
months
Number of months. Range of month is (-11 to 11).
The sign of all the arguments must be the same.
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
.
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.
// C#
public OracleIntervalYM (byte[] bytes);
bytes
A byte array that is in an internal Oracle INTERVAL
YEAR
TO
MONTH
format.
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.
The supplied byte array must be in an internal Oracle INTERVAL
YEAR
TO
MONTH
format.
The OracleIntervalYM
static fields are listed in Table 14-68.
Table 14-68 OracleIntervalYM Static Fields
Field | Description |
---|---|
Represents the maximum value for an |
|
Represents the minimum value for an |
|
Represents a null value that can be assigned to an |
|
Represents a zero value for an |
This static field represents the maximum value for an OracleIntervalYM
structure.
// C# public static readonly OracleIntervalYM MaxValue;
Year is 999999999 and Month is 11.
This static field represents the minimum value for an OracleIntervalYM
structure.
// C# public static readonly OracleIntervalYM MinValue;
Year is -999999999 and Month is -11.
This static field represents a null value that can be assigned to an OracleIntervalYM
instance.
// C# public static readonly OracleIntervalYM Null;
This static field represents a zero value for an OracleIntervalYM
structure.
// C# public static readonly OracleIntervalDS Zero;
The OracleIntervalYM
static methods are listed in Table 14-69.
Table 14-69 OracleIntervalYM Static Methods
Methods | Description |
---|---|
Determines whether or not two |
|
Determines whether or not one |
|
Determines whether or not one |
|
Determines whether or not one |
|
Determines whether or not one |
|
Determines whether two |
|
Returns an |
|
Returns a new instance of an |
This static method determines whether or not two OracleIntervalYM
values are equal.
// C# public static bool Equals(OracleIntervalYM val1, OracleIntervalYM val2);
val1
An OracleIntervalYM
structure.
val2
An OracleIntervalYM
structure.
Returns true
if two OracleIntervalYM
values represent the same time interval, otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static method determines whether or not the first of two OracleIntervalYM
values is greater than the second.
// C# public static bool GreaterThan(OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if the first of two OracleIntervalYM
values is greater than the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static method determines whether or not the first of two OracleIntervalYM
values is greater than or equal to the second.
// C# public static bool GreaterThanOrEqual(OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if the first of two OracleIntervalYM
values is greater than or equal to the second; otherwise returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static method determines whether or not the first of two OracleIntervalYM
values is less than the second.
// C# public static bool LessThan(OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if the first of two OracleIntervalYM
values is less than the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static method determines whether or not the first of two OracleIntervalYM
values is less than or equal to the second.
// C# public static bool LessThanOrEqual(OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if the first of two OracleIntervalYM
values is less than or equal to the second. Returns false
otherwise.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static method determines whether two OracleIntervalYM
values are not equal.
// C# public static bool NotEquals(OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if two OracleIntervalYM
values are not equal. Returns false
otherwise.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static method returns an OracleIntervalYM
structure and sets its value for time interval using a string.
// C#
public static OracleIntervalYM Parse (string intervalStr);
intervalStr
A string representing the Oracle INTERVAL
YEAR
TO
MONTH
.
Returns an OracleIntervalYM
structure.
ArgumentException
- The intervalStr
parameter is not in the valid format or intervalStr
has an invalid value.
ArgumentNullException
- The intervalStr
parameter is null.
The value specified in the supplied intervalStr
must be in the Year-Month format.
"1-2" means 1 year and 2 months.
This static method returns a new instance of an OracleIntervalYM
with the specified year precision.
// C# public static OracleIntervalYM SetPrecision(OracleIntervalYM value1, int yearPrecision);
value1
An OracleIntervalYM
structure.
yearPrecision
The year precision provided. Range of year precision is (0 to 9).
An OracleIntervalDS
instance.
ArgumentOutOfRangeException
- yearPrecision
is out of the specified range.
Depending on the value specified in the supplied yearPrecision
, 0
or more leading zeros are displayed in the string returned by ToString()
.
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
.
The OracleIntervalYM
static operators are listed in Table 14-70.
Table 14-70 OracleIntervalYM Static Operators
Operator | Description |
---|---|
Adds two |
|
Determines whether or not two |
|
Determines whether or not one |
|
Determines whether or not one |
|
Determines whether two |
|
Determines whether or not one |
|
Determines whether or not one |
|
Subtracts one |
|
Negates an |
|
Multiplies an |
|
Divides an |
This static operator adds two OracleIntervalYM
values.
// C# public static OracleIntervalYM operator + (OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
OracleIntervalYM
If either argument has a null value, the returned OracleIntervalYM
structure has a null value.
This static operator determines if two OracleIntervalYM
values are equal.
// C# public static bool operator == (OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if they are equal; otherwise returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static operator determines if the first of two OracleIntervalYM
values is greater than the second.
// C# public static bool operator > (OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if one OracleIntervalYM
value is greater than another; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static operator determines if the first of two OracleIntervalYM
values is greater than or equal to the second.
// C# public static bool operator >= (OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if one OracleIntervalYM
value is greater than or equal to another; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static operator determines whether two OracleIntervalYM
values are not equal.
// C# public static bool operator != (OracleIntervalYM val1, OracleIntervalYM val2)
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if two OracleIntervalYM
values are not equal; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static operator determines if the first of two OracleIntervalYM
values is less than the second.
// C# public static bool operator < (OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if the first of two OracleIntervalYM
values is less than the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static operator determines if the first of two OracleIntervalYM
values is less than or equal to the second.
// C# public static bool operator <= (OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
Returns true
if the first of two OracleIntervalYM
values is less than or equal to the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
This static operator subtracts one OracleIntervalYM
structure from another.
// C# public static OracleIntervalYM operator - (OracleIntervalYM val1, OracleIntervalYM val2);
val1
The first OracleIntervalYM
.
val2
The second OracleIntervalYM
.
An OracleIntervalYM
structure.
If either argument has a null value, the returned OracleIntervalYM
structure has a null value.
This static operator negates an OracleIntervalYM
structure.
// C#
public static OracleIntervalYM operator - (OracleIntervalYM val);
val
An OracleIntervalYM
.
An OracleIntervalYM
structure.
If the supplied OracleIntervalYM
structure has a null value, the returned OracleIntervalYM
structure has a null value.
This static operator multiplies an OracleIntervalYM
value by a number.
// C# public static OracleIntervalYM operator * (OracleIntervalYM val1, int multiplier);
val1
The first OracleIntervalYM
.
multiplier
A multiplier.
An OracleIntervalYM
structure.
If the supplied OracleIntervalYM
structure has a null value, the returned OracleIntervalYM
structure has a null value.
This static operator divides an OracleIntervalYM
value by a number.
// C#
public static OracleIntervalYM operator / (OracleIntervalYM val1, int divisor);
val1
The first OracleIntervalYM
.
divisor
A divisor.
An OracleIntervalYM
structure.
If the supplied OracleIntervalYM
structure has a null value, the returned OracleIntervalYM
structure has a null value.
The OracleIntervalYM
conversions are listed in Table 14-71.
Table 14-71 OracleIntervalYM Type Conversions
Operator | Description |
---|---|
Converts an |
|
Converts a string to an |
|
Converts the number of months to an |
This type conversion operator converts an OracleIntervalYM
to a number that represents the number of months in the time interval.
// C#
public static explicit operator long (OracleIntervalYM val);
val
An OracleIntervalYM
structure.
A long
number in months.
OracleNullValueException
- The OracleIntervalYM
structure has a null value.
This type conversion operator converts the string intervalStr
to an OracleIntervalYM
structure.
// C#
public static explicit operator OracleIntervalYM (string intervalStr);
intervalStr
A string representation of an Oracle INTERVAL
YEAR
TO
MONTH
.
An OracleIntervalYM
structure.
ArgumentException
- The supplied intervalStr
parameter is not in the correct format or has an invalid value.
ArgumentNullException
- The intervalStr
parameter is null.
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.
This type conversion operator converts the total number of months as time interval to an OracleIntervalYM
structure.
// C#
public static implicit operator OracleIntervalYM (long months);
months
The number of months to be converted. Range is (-999,999,999 * 12)-11 <= months
<= (999,999,999 * 12)+11.
An OracleIntervalYM
structure.
ArgumentOutOfRangeException
- The months
parameter is out of the specified range.
The OracleIntervalYM
properties are listed in Table 14-72.
Table 14-72 OracleIntervalYM Properties
Properties | Description |
---|---|
Returns an array of bytes that represents the Oracle |
|
Indicates whether or not the current instance has a null value |
|
Gets the months component of an |
|
Returns the total number, in years, that represents the period of time in the current |
|
Specifies the total number of months that is stored in the |
|
Gets the years component of an |
This property returns an array of bytes that represents the Oracle INTERVAL
YEAR
TO
MONTH
in Oracle internal format.
// C# public byte[] BinData {get;}
A byte array that represents an Oracle INTERVAL
YEAR
TO
MONTH
in Oracle internal format.
OracleNullValueException
- The current instance has a null value.
This property indicates whether or not the value has a null value.
// C# public bool IsNull {get;}
Returns true
if value has a null value; otherwise, returns false
.
This property gets the months component of an OracleIntervalYM.
// C# public int Months {get;}
An int
representing the months component.
OracleNullValueException
- The current instance has a null value.
This property returns the total number, in years, that represents the period of time in the current OracleIntervalYM
structure.
// C# public double TotalYears {get;}
A double
representing the total number of years.
OracleNullValueException
- The current instance has a null value.
This property gets the total number of months that is stored in the OracleIntervalYM
structure.
// C# public long Value {get;}
The total number of months representing the time interval.
OracleNullValueException
- The current instance has a null value.
This property gets the years component of an OracleIntervalYM
.
// C# public int Years {get;}
An int
representing the years component.
OracleNullValueException
- The current instance has a null value.
The OracleIntervalYM
methods are listed in Table 14-73.
Table 14-73 OracleIntervalYM Methods
Methods | Description |
---|---|
Compares the current |
|
Determines whether or not the specified |
|
Returns a hash code for the |
|
GetType |
Inherited from |
Converts the current |
This method compares the current OracleIntervalYM
instance to the supplied object, and returns an integer that represents their relative values.
// C#
public int CompareTo(object obj);
obj
The supplied object.
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.
IComparable
ArgumentException
- The obj
parameter is not of type OracleIntervalYM
.
The following rules apply to the behavior of this method.
The comparison must be between OracleIntervalYM
s. For example, comparing an OracleIntervalYM
instance with an OracleBinary
instance is not allowed. When an OracleIntervalYM
is compared with a different type, an ArgumentException
is thrown.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
Overrides Object
This method determines whether or not the specified object has the same time interval as the current instance.
// C#
public override bool Equals(object obj);
obj
The supplied object.
Returns true
if the specified object instance is of type OracleIntervalYM
and has the same time interval; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleIntervalYM
that has a value compares greater than an OracleIntervalYM
that has a null value.
Two OracleIntervalYM
s that contain a null value are equal.
Overrides Object
This method returns a hash code for the OracleIntervalYM
instance.
// C# public override int GetHashCode();
An int
representing a hash code.
Overrides Object
This method converts the current OracleIntervalYM
structure to a string.
// C# public override string ToString();
A string that represents the current OracleIntervalYM
structure.
If the current instance has a null value, the returned string contain "null".