The OracleDecimal
structure represents an Oracle NUMBER
in the database or any Oracle numeric value.
System.Object
System.ValueType
Oracle.DataAccess.Types.OracleDecimal
// ADO.NET 2.0: C# public struct OracleDecimal : IComparable, INullable, IXmlSerializable
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
OracleDecimal
can store up to 38 precision, while the .NET Decimal
data type can only hold up to 28 precision. When accessing the OracleDecimal.Value
property from an OracleDecimal
that has a value greater than 28 precision, an exception is thrown. 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.
// C# using System; using Oracle.DataAccess.Types; class OracleDecimalSample { static void Main(string[] args) { // Illustrates the range of OracleDecimal vs. .NET decimal OracleDecimal decimal1 = OracleDecimal.MinValue; OracleDecimal decimal2 = OracleDecimal.MaxValue; OracleDecimal decimal3 = new OracleDecimal(decimal.MinValue); OracleDecimal decimal4 = new OracleDecimal(decimal.MaxValue); // Print the ranges Console.WriteLine("OracleDecimal can range from\n{0}\nto\n{1}\n", decimal1, decimal2); Console.WriteLine(".NET decimal can range from\n{0}\nto\n{1}", decimal3, decimal4); } }
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:
OracleDecimal
members are listed in the following tables:
OracleDecimal
constructors are listed in Table 14-27
Table 14-27 OracleDecimal Constructors
Constructor | Description |
---|---|
Instantiates a new instance of |
The OracleDecimal
static fields are listed in Table 14-28.
Table 14-28 OracleDecimal Static Fields
Field | Description |
---|---|
A constant representing the maximum precision, which is 38 |
|
A constant representing the maximum scale, which is 127 |
|
A constant representing the maximum value for this structure, which is 9.9…9 x 10125 |
|
A constant representing the minimum scale, which is -84 |
|
A constant representing the minimum value for this structure, which is -1.0 x 10130 |
|
A constant representing the negative one value |
|
Represents a null value that can be assigned to an |
|
A constant representing the positive one value |
|
A constant representing the numeric Pi value |
|
A constant representing the zero value |
OracleDecimal Static (Comparison) Methods
The OracleDecimal
static (comparison) methods are listed in Table 14-29.
Table 14-29 OracleDecimal Static (Comparison) Methods
Methods | Description |
---|---|
Determines if two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if two |
OracleDecimal Static (Manipulation) Methods
The OracleDecimal
static (manipulation) methods are listed in Table 14-30.
Table 14-30 OracleDecimal Static (Manipulation) Methods
Methods | Description |
---|---|
Returns the absolute value of an |
|
Adds two |
|
Returns a new |
|
Returns a new |
|
Returns a new |
|
Divides one |
|
Returns a new |
|
Returns the maximum value of the two supplied |
|
Returns the minimum value of the two supplied |
|
Returns a new |
|
Returns a new |
|
Returns a new |
|
Converts a |
|
Returns a new |
|
Returns a new |
|
Returns a new |
|
Determines the sign of an |
|
Returns a new |
|
Returns a new |
|
Truncates the |
OracleDecimal Static (Logarithmic) Methods
The OracleDecimal
static (logarithmic) methods are listed in Table 14-31.
Table 14-31 OracleDecimal Static (Logarithmic) Methods
Methods | Description |
---|---|
Returns a new |
|
Returns the supplied |
|
Returns a new |
OracleDecimal Static (Trigonometric) Methods
The OracleDecimal
static (trigonometric) methods are listed in Table 14-32.
Table 14-32 OracleDecimal Static (Trigonometric) Methods
Methods | Description |
---|---|
Returns an angle in radians whose cosine is the supplied |
|
Returns an angle in radians whose sine is the supplied |
|
Returns an angle in radians whose tangent is the supplied |
|
Returns an angle in radians whose tangent is the quotient of the two supplied |
|
Returns the cosine of the supplied angle in radians |
|
Returns the sine of the supplied angle in radians |
|
Returns the tangent of the supplied angle in radians |
|
Returns the hyperbolic cosine of the supplied angle in radians |
|
Returns the hyperbolic sine of the supplied angle in radians |
|
Returns the hyperbolic tangent of the supplied angle in radians |
OracleDecimal Static (Comparison) Operators
The OracleDecimal
static (comparison) operators are listed in Table 14-33.
Table 14-33 OracleDecimal Static (Comparison) Operators
Operator | Description |
---|---|
Adds two |
|
Divides one |
|
Determines if the two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if the two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Multiplies two |
|
Subtracts one |
|
Negates an |
|
Returns a new |
OracleDecimal Static Operators (Conversion from .NET Type to OracleDecimal)
The OracleDecimal
static operators (Conversion from .NET Type to OracleDecimal
) are listed in Table 14-34.
Table 14-34 OracleDecimal Static Operators (Conversion from .NET Type to OracleDecimal)
Operator | Description |
---|---|
Converts an instance value to an |
|
Converts an instance value to an |
OracleDecimal Static Operators (Conversion from OracleDecimal to .NET)
The OracleDecimal
static operators (Conversion from OracleDecimal
to .NET) are listed in Table 14-35.
Table 14-35 OracleDecimal Static Operators (Conversion from OracleDecimal to .NET)
Operator | Description |
---|---|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
The OracleDecimal
properties are listed in Table 14-36.
Table 14-36 OracleDecimal Properties
Properties | Description |
---|---|
Returns a byte array that represents the Oracle |
|
Specifies the format for |
|
Indicates whether or not the current instance is an integer |
|
Indicates whether or not the current instance has a null value |
|
Indicates whether or not the current instance is greater than |
|
Indicates whether or not the current instance has a |
|
Returns a |
OracleDecimal Instance Methods
The OracleDecimal
instance methods are listed in Table 14-37.
Table 14-37 OracleDecimal Instance Methods
Method | Description |
---|---|
Compares the current instance to the supplied object and returns an integer that represents their relative values |
|
Determines whether or not an object is an instance of |
|
Returns a hash code for the current instance |
|
GetType |
Inherited from |
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Overloads Returns the |
The OracleDecimal
constructors instantiate a new instance of the OracleDecimal
structure.
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.
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied Decimal
value.
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied double
value.
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied Int32
value.
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied Single
value.
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied Int64
value.
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied string
value.
This constructor creates a new instance of the OracleDecimal
structure with the supplied string
value and number format.
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.
// C# public OracleDecimal(byte [] bytes);
bytes
A byte array that represents an Oracle NUMBER
in an internal Oracle format.
ArgumentException
- The bytes
parameter is not in a internal Oracle NUMBER
format or bytes
has an invalid value.
ArgumentNullException
- The bytes
parameter is null.
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied Decimal
value.
// C#
public OracleDecimal(decimal decX);
decX
The provided Decimal
value.
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied double
value.
// C#
public OracleDecimal(double doubleX)
doubleX
The provided double value.
OverFlowException
- The value of the supplied double
is greater than the maximum value or less than the minimum value of OracleDecimal
.
OracleDecimal
contains the following values depending on the provided double value:
double.PositiveInfinity
: positive infinity value
double.NegativeInfinity
: negative infinity value.
double.NaN
: null value
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied Int32
value.
// C#
public OracleDecimal(int intX);
intX
The provided Int32
value.
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied Single
value.
// C#
public OracleDecimal(float floatX);
floatX
The provided float
value.
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
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied Int64
value.
// C#
public OracleDecimal(long longX);
longX
The provided Int64
value.
This constructor creates a new instance of the OracleDecimal
structure and sets its value to the supplied string
value.
// C#
public OracleDecimal(string numStr);
numStr
The provided string
value.
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
.
This constructor creates a new instance of the OracleDecimal
structure with the supplied string
value and number format.
// C# public OracleDecimal(string numStr, string format);
numStr
The provided string
value.
format
The provided number format
.
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
.
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.
// C# using System; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; class OracleDecimalSample { static void Main(string[] args) { // Set the nls parameters related to currency OracleGlobalization info = OracleGlobalization.GetClientInfo(); info.Currency = "$"; info.NumericCharacters = ".,"; OracleGlobalization.SetThreadInfo(info); // Construct an OracleDecimal using a valid numeric format OracleDecimal dec = new OracleDecimal("$2,222.22","L9G999D99"); // Print "$2,222.22" Console.WriteLine(dec.ToString()); } }
The OracleDecimal
static fields are listed in Table 14-38.
Table 14-38 OracleDecimal Static Fields
Field | Description |
---|---|
A constant representing the maximum precision, which is 38 |
|
A constant representing the maximum scale, which is 127 |
|
A constant representing the maximum value for this structure, which is 9.9…9 x 10125 |
|
A constant representing the minimum scale, which is -84 |
|
A constant representing the minimum value for this structure, which is -1.0 x 10130 |
|
A constant representing the negative one value |
|
Represents a null value that can be assigned to an |
|
A constant representing the positive one value |
|
A constant representing the numeric Pi value |
|
A constant representing the zero value |
This static field represents the maximum precision, which is 38.
// C# public static readonly byte MaxPrecision;
This static field a constant representing the maximum scale, which is 127.
// C# public static readonly byte MaxScale;
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).
// C# public static readonly OracleDecimal MaxValue;
This static field indicates a constant representing the maximum scale, which is -84.
// C# public static readonly int MinScale;
This static field indicates a constant representing the minimum value for this structure, which is -1.0 x 10130.
// C# public static readonly OracleDecimal MinValue;
This static field indicates a constant representing the negative one value.
// C# public static readonly OracleDecimal NegativeOne;
This static field represents a null value that can be assigned to an OracleDecimal
instance.
// C# public static readonly OracleDecimal Null;
This static field indicates a constant representing the positive one value.
// C# public static readonly OracleDecimal One;
This static field indicates a constant representing the numeric Pi value.
// C# public static readonly OracleDecimal Pi;
The OracleDecimal
static (comparison) methods are listed in Table 14-39.
Table 14-39 OracleDecimal Static (Comparison) Methods
Methods | Description |
---|---|
Determines if two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if two |
This method determines if two OracleDecimal
values are equal.
// C# public static bool Equals(OracleDecimal value1, OracleDecimal value2);
value1
The first OracleDecimal
.
value2
The second OracleDecimal
.
Returns true
if two OracleDecimal
values are equal; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method determines if the first of two OracleDecimal
values is greater than the second.
// C# public static bool GreaterThan(OracleDecimal value1, OracleDecimal value2);
value1
The first OracleDecimal
.
value2
The second OracleDecimal.
Returns true
if the first of two OracleDecimal
values is greater than the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method determines if the first of two OracleDecimal
values is greater than or equal to the second.
// C# public static bool GreaterThanOrEqual(OracleDecimal value1, OracleDecimal value2);
value1
The first OracleDecimal
.
value2
The second OracleDecimal
.
Returns true
if the first of two OracleDecimal
values is greater than or equal to the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method determines if the first of two OracleDecimal
values is less than the second.
// C# public static bool LessThan(OracleDecimal value1, OracleDecimal value2);
value1
The first OracleDecimal
.
value2
The second OracleDecimal
.
Returns true
if the first of two OracleDecimal
values is less than the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method determines if the first of two OracleDecimal
values is less than or equal to the second.
// C# public static bool LessThanOrEqual(OracleDecimal value1, OracleDecimal value2);
value1
The first OracleDecimal
.
value2
The second OracleDecimal
.
Returns true
if the first of two OracleDecimal
values is less than or equal to the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method determines if two OracleDecimal
values are not equal.
// C# public static bool NotEquals(OracleDecimal value1, OracleDecimal value2);
value1
The first OracleDecimal
.
value2
The second OracleDecimal
.
Returns true
if two OracleDecimal
values are not equal; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
The OracleDecimal
static (manipulation) methods are listed in Table 14-40.
Table 14-40 OracleDecimal Static (Manipulation) Methods
Methods | Description |
---|---|
Returns the absolute value of an |
|
Adds two |
|
Returns a new |
|
Returns a new |
|
Returns a new |
|
Divides one |
|
Returns a new |
|
Returns the maximum value of the two supplied |
|
Returns the minimum value of the two supplied |
|
Returns a new |
|
Returns a new |
|
Returns a new |
|
Converts a |
|
Returns a new |
|
Returns a new |
|
Returns a new |
|
Determines the sign of an |
|
Returns a new |
|
Returns a new |
|
Truncates the |
This method returns the absolute value of an OracleDecimal
.
// C#
public static OracleDecimal Abs(OracleDecimal val);
val
An OracleDecimal
.
The absolute value of an OracleDecimal
.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method adds two OracleDecimal
structures.
// C# public static OracleDecimal Add(OracleDecimal val1, OracleDecimal val2);
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
Returns an OracleDecimal
structure.
If either argument has a null value, the returned OracleDecimal
has a null value.
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.
// C# public static OracleDecimal AdjustScale(OracleDecimal val, int digits, bool fRound);
val
An OracleDecimal
.
digits
The number of digits.
fRound
Indicates whether or not to round or truncate the number. Setting it to true
rounds the number and setting it to false
truncates the number.
An OracleDecimal
.
If the supplied OracleDecimal
has a null value, the returned OracleDecimal
has a null value.
// C# using System; using Oracle.DataAccess.Types; class AdjustScaleSample { static void Main(string[] args) { OracleDecimal dec1 = new OracleDecimal(5.555); // Adjust Scale to 2 with rounding off OracleDecimal dec2 = OracleDecimal.AdjustScale(dec1, 2, true); // Prints 5.56 Console.WriteLine(dec2.ToString()); // Adjust Scale to 2 with truncation OracleDecimal dec3 = OracleDecimal.AdjustScale(dec1, 2, false); // Prints 5.55 Console.WriteLine(dec3.ToString()); } }
This method returns a new OracleDecimal
structure with its value set to the ceiling of the supplied OracleDecimal
.
// C#
public static OracleDecimal Ceiling(OracleDecimal val);
val
An OracleDecimal
.
A new OracleDecimal
structure.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns a new OracleDecimal
structure with a new precision and scale.
// C# public static OracleDecimal ConvertToPrecScale(OracleDecimal val int precision, int scale);
val
An OracleDecimal
structure.
precision
The precision. Range of precision is 1 to 38.
scale
The number of digits to the right of the decimal point. Range of scale is -84 to 127.
A new OracleDecimal
structure.
If the supplied OracleDecimal
has a null value, the returned OracleDecimal
has a null value.
// C# using System; using Oracle.DataAccess.Types; class ConvertToPrecScaleSample { static void Main(string[] args) { OracleDecimal dec1 = new OracleDecimal(555.6666); // Set the precision of od to 5 and scale to 2 OracleDecimal dec2 = OracleDecimal.ConvertToPrecScale(dec1,5,2); // Prints 555.67 Console.WriteLine(dec2.ToString()); // Set the precision of od to 3 and scale to 0 OracleDecimal dec3 = OracleDecimal.ConvertToPrecScale(dec1,3,0); // Prints 556 Console.WriteLine(dec3.ToString()); } }
This method divides one OracleDecimal
value by another.
// C# public static OracleDecimal Divide(OracleDecimal val1, OracleDecimal val2);
val1
An OracleDecimal
.
val2
An OracleDecimal
.
A new OracleDecimal
structure.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns a new OracleDecimal
structure with its value set to the floor of the supplied OracleDecimal
structure.
// C#
public static OracleDecimal Floor(OracleDecimal val);
val
An OracleDecimal
structure.
A new OracleDecimal
structure.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns the maximum value of the two supplied OracleDecimal
structures.
// C# public static OracleDecimal Max(OracleDecimal val1, OracleDecimal val2);
val1
An OracleDecimal
structure.
val2
An OracleDecimal
structure.
An OracleDecimal
structure that has the greater value.
This method returns the minimum value of the two supplied OracleDecimal
structures.
// C# public static OracleDecimal Min(OracleDecimal val1, OracleDecimal val2);
val1
An OracleDecimal
structure.
val2
An OracleDecimal
structure.
An OracleDecimal
structure that has the smaller value.
This method returns a new OracleDecimal
structure with its value set to the modulus of two OracleDecimal
structures.
// C# public static OracleDecimal Mod(OracleDecimal val1, OracleDecimal divider);
val1
An OracleDecimal
structure.
divider
An OracleDecimal
structure.
An OracleDecimal
.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns a new OracleDecimal
structure with its value set to the result of multiplying two OracleDecimal
structures.
// C# public static OracleDecimal Multiply(OracleDecimal val1, OracleDecimal val2);
val1
An OracleDecimal
structure.
val2
An OracleDecimal
structure.
A new OracleDecimal
structure.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns a new OracleDecimal
structure with its value set to the negation of the supplied OracleDecimal
structures.
// C#
public static OracleDecimal Negate(OracleDecimal val);
val
An OracleDecimal
structure.
A new OracleDecimal
structure.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method converts a string
to an OracleDecimal
.
// C#
public static OracleDecimal Parse (string str);
str
The string being converted.
A new OracleDecimal
structure.
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
.
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.
// C# public static OracleDecimal Round(OracleDecimal val, int decplace);
val
An OracleDecimal
structure.
decplace
The specified decimal place. If the value is positive, the function rounds the OracleDecimal
structure to the right of the decimal point. If the value is negative, the function rounds to the left of the decimal point.
An OracleDecimal
structure.
If the supplied OracleDecimal
structure has a null value, the returned OracleDecimal
has a null value.
This method returns a new OracleDecimal
structure with a new specified precision.
// C# public static OracleDecimal SetPrecision(OracleDecimal val, int precision);
val
An OracleDecimal
structure.
precision
The specified precision. Range of precision is 1 to 38.
An OracleDecimal
structure.
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.
// C# using System; using Oracle.DataAccess.Types; class SetPrecisionSample { static void Main(string[] args) { OracleDecimal dec1 = new OracleDecimal(555.6666); // Set the precision of dec1 to 3 OracleDecimal dec2 = OracleDecimal.SetPrecision(dec1, 3); // Prints 556 Console.WriteLine(dec2.ToString()); // Set the precision of dec1 to 4 OracleDecimal dec3 = OracleDecimal.SetPrecision(dec1, 4); // Prints 555.7 Console.WriteLine(dec3.ToString()); } }
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.
// C# public static OracleDecimal Shift(OracleDecimal val, int decplaces);
val
An OracleDecimal
structure.
decplaces
The specified number of places to be shifted.
An OracleDecimal
structure.
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.
This method determines the sign of an OracleDecimal
structure.
// C#
public static int Sign(OracleDecimal val);
val
An OracleDecimal
structure.
-1
: if the supplied OracleDecimal
<
0
0
: if the supplied OracleDecimal
==
0
1
: if the supplied OracleDecimal
>
0
OracleNullValueException
- The argument has a null value.
This method returns a new OracleDecimal
structure with its value set to the square root of the supplied OracleDecimal
structure.
// C#
public static OracleDecimal Sqrt(OracleDecimal val);
val
An OracleDecimal
structure.
An OracleDecimal
structure.
ArgumentOutOfRangeException
- The provided OracleDecimal
structure is less than zero.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns a new OracleDecimal
structure with its value set to result of subtracting one OracleDecimal
structure from another.
// C# public static OracleDecimal Subtract(OracleDecimal val1, OracleDecimal val2);
val1
An OracleDecimal
structure.
val2
An OracleDecimal
structure.
An OracleDecimal
structure.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method truncates the OracleDecimal
at a specified position.
// C# public static OracleDecimal Truncate(OracleDecimal val, int pos);
val
An OracleDecimal
structure.
pos
The specified position. If the value is positive, the function truncates the OracleDecimal
structure to the right of the decimal point. If the value is negative, it truncates the OracleDecimal
structure to the left of the decimal point.
An OracleDecimal
structure.
If the supplied OracleDecimal
structure has a null value, the returned OracleDecimal
has a null value.
The OracleDecimal
static (logarithmic) methods are listed in Table 14-41.
Table 14-41 OracleDecimal Static (Logarithmic) Methods
Methods | Description |
---|---|
Returns a new |
|
Returns the supplied |
|
Returns a new |
This method returns a new OracleDecimal
structure with its value set to e raised to the supplied OracleDecimal
.
// C#
public static OracleDecimal Exp(OracleDecimal val);
val
An OracleDecimal
structure.
An OracleDecimal
structure.
If either argument has a null value, the returned OracleDecimal
has a null value.
Log
returns the supplied OracleDecimal
structure with its value set to the logarithm of the supplied OracleDecimal
structure.
This method returns a new OracleDecimal
structure with its value set to the natural logarithm (base e) of the supplied OracleDecimal
structure.
This method returns the supplied OracleDecimal
structure with its value set to the logarithm of the supplied OracleDecimal
structure in the supplied base.
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.
This method returns a new OracleDecimal
structure with its value set to the natural logarithm (base e) of the supplied OracleDecimal
structure.
// C#
public static OracleDecimal Log(OracleDecimal val);
val
An OracleDecimal
structure whose logarithm is to be calculated.
Returns a new OracleDecimal
structure with its value set to the natural logarithm (base e) of val
.
ArgumentOutOfRangeException
- The supplied OracleDecimal
value is less than zero.
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.
This method returns the supplied OracleDecimal
structure with its value set to the logarithm of the supplied OracleDecimal
structure in the supplied base.
// C# public static OracleDecimal Log(OracleDecimal val, int logBase);
val
An OracleDecimal
structure whose logarithm is to be calculated.
logBase
An int
that specifies the base of the logarithm.
A new OracleDecimal
structure with its value set to the logarithm of val
in the supplied base.
ArgumentOutOfRangeException
- Either argument is less than zero.
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.
This method returns the supplied OracleDecimal
structure with its value set to the logarithm of the supplied OracleDecimal
structure in the supplied base.
// C# public static OracleDecimal Log(OracleDecimal val, OracleDecimal logBase);
val
An OracleDecimal
structure whose logarithm is to be calculated.
logBase
An OracleDecimal
structure that specifies the base of the logarithm.
Returns the logarithm of val
in the supplied base.
ArgumentOutOfRangeException
- Either the val
or logBase
parameter is less than zero.
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
returns a new OracleDecimal
structure with its value set to the supplied OracleDecimal
structure raised to the supplied power.
This method returns a new OracleDecimal
structure with its value set to the supplied OracleDecimal
value raised to the supplied Int32
power.
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.
This method returns a new OracleDecimal
structure with its value set to the supplied OracleDecimal
value raised to the supplied Int32
power.
// C# public static OracleDecimal Pow(OracleDecimal val, int power);
val
An OracleDecimal
structure.
power
An int
value that specifies the power.
An OracleDecimal
structure.
If the supplied OracleDecimal
structure has a null value, the returned OracleDecimal
has a null value.
This method returns a new OracleDecimal
structure with its value set to the supplied OracleDecimal
structure raised to the supplied OracleDecimal
power.
// C# public static OracleDecimal Pow(OracleDecimal val, OracleDecimal power);
val
An OracleDecimal
structure.
power
An OracleDecimal
structure that specifies the power.
An OracleDecimal
structure.
If the supplied OracleDecimal
structure has a null value, the returned OracleDecimal
has a null value.
The OracleDecimal
static (trigonometric) methods are listed in Table 14-42.
Table 14-42 OracleDecimal Static (Trigonometric) Methods
Methods | Description |
---|---|
Returns an angle in radians whose cosine is the supplied |
|
Returns an angle in radians whose sine is the supplied |
|
Returns an angle in radians whose tangent is the supplied |
|
Returns an angle in radians whose tangent is the quotient of the two supplied |
|
Returns the cosine of the supplied angle in radians |
|
Returns the sine of the supplied angle in radians |
|
Returns the tangent of the supplied angle in radians |
|
Returns the hyperbolic cosine of the supplied angle in radians |
|
Returns the hyperbolic sine of the supplied angle in radians |
|
Returns the hyperbolic tangent of the supplied angle in radians |
This method returns an angle in radians whose cosine is the supplied OracleDecimal
structure.
// C#
public static OracleDecimal Acos(OracleDecimal val);
val
An OracleDecimal
structure. Range is (-1 to 1).
An OracleDecimal
structure that represents an angle in radians.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns an angle in radians whose sine is the supplied OracleDecimal
structure.
// C#
public static OracleDecimal Asin(OracleDecimal val);
val
An OracleDecimal
structure. Range is (-1 to 1).
An OracleDecimal
structure that represents an angle in radians.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns an angle in radians whose tangent is the supplied OracleDecimal
structure
// C#
public static OracleDecimal Atan(OracleDecimal val);
val
An OracleDecimal
.
An OracleDecimal
structure that represents an angle in radians.
If the argument has a null value, the returned OracleDecimal
has a null value.
This method returns an angle in radians whose tangent is the quotient of the two supplied OracleDecimal
structures.
// C# public static OracleDecimal Atan2(OracleDecimal val1, OracleDecimal val2);
val1
An OracleDecimal
structure that represents the y-coordinate.
val2
An OracleDecimal
structure that represents the x-coordinate.
An OracleDecimal
structure that represents an angle in radians.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns the cosine of the supplied angle in radians.
// C#
public static OracleDecimal Cos(OracleDecimal val);
val
An OracleDecimal
structure that represents an angle in radians.
An OracleDecimal
instance.
ArgumentOutOfRangeException
- The val
parameter is positive or negative infinity.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns the sine of the supplied angle in radians.
// C#
public static OracleDecimal Sin(OracleDecimal val);
val
An OracleDecimal
structure.
An OracleDecimal
structure that represents an angle in radians.
ArgumentOutOfRangeException
- The val
parameter is positive or negative infinity.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns the tangent of the supplied angle in radians.
// C#
public static OracleDecimal Tan(OracleDecimal val);
val
An OracleDecimal
structure that represents an angle in radians.
An OracleDecimal
instance.
ArgumentOutOfRangeException
- The val
parameter is positive or negative infinity.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns the hyperbolic cosine of the supplied angle in radians.
// C#
public static OracleDecimal Cosh(OracleDecimal val);
val
An OracleDecimal
structure that represents an angle in radians.
An OracleDecimal
instance.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns the hyperbolic sine of the supplied angle in radians.
// C#
public static OracleDecimal Sinh(OracleDecimal val);
val
An OracleDecimal
structure that represents an angle in radians.
An OracleDecimal
instance.
If either argument has a null value, the returned OracleDecimal
has a null value.
This method returns the hyperbolic tangent of the supplied angle in radians.
// C#
public static OracleDecimal Tanh(OracleDecimal val);
val
An OracleDecimal
structure that represents an angle in radians.
An OracleDecimal
instance.
If either argument has a null value, the returned OracleDecimal
has a null value.
The OracleDecimal
static (comparison) operators are listed in Table 14-43.
Table 14-43 OracleDecimal Static (Comparison) Operators
Operator | Description |
---|---|
Adds two |
|
Divides one |
|
Determines if the two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Determines if the two |
|
Determines if the first of two |
|
Determines if the first of two |
|
Multiplies two |
|
Subtracts one |
|
Negates an |
|
Returns a new |
This method adds two OracleDecimal
values.
// C# public static OracleDecimal operator + (OracleDecimal val1, OracleDecimal val2);
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
An OracleDecimal
structure.
If either operand has a null value, the returned OracleDecimal
has a null value.
This method divides one OracleDecimal
value by another.
/ C# public static OracleDecimal operator / (OracleDecimal val1, OracleDecimal val2)
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
An OracleDecimal
structure.
If either operand has a null value, the returned OracleDecimal
has a null value.
This method determines if two OracleDecimal
values are equal.
// C# public static bool operator == (OracleDecimal val1, OracleDecimal val2);
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
Returns true
if their values are equal; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method determines if the first of two OracleDecimal
values is greater than the second.
// C# public static bool operator > (OracleDecimal val1, OracleDecimal val2);
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
Returns true
if the two OracleDecimal
values are not equal; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method determines if the first of two OracleDecimal
values is greater than or equal to the second.
// C# public static bool operator >= (OracleDecimal val1, OracleDecimal val2);
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
Returns true
if the first of two OracleDecimal
values is greater than or equal to the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method determines if the first of two OracleDecimal
values are not equal.
// C# public static bool operator != (OracleDecimal val1, OracleDecimal val2);
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
Returns true
if the two OracleDecimal
values are not equal; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method determines if the first of two OracleDecimal
values is less than the second.
// C# public static bool operator < (OracleDecimal val1, OracleDecimal val2);
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
Returns true
if the first of two OracleDecimal
values is less than the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method determines if the first of two OracleDecimal
values is less than or equal to the second.
// C# public static bool operator <= (OracleDecimal val1, OracleDecimal val2);
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
Returns true
if the first of two OracleDecimal
values is less than or equal to the second; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
This method multiplies two OracleDecimal
structures.
// C# public static OracleDecimal operator * (OracleDecimal val1, OracleDecimal val2);
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
A new OracleDecimal
structure.
If either operand has a null value, the returned OracleDecimal
has a null value.
This method subtracts one OracleDecimal
structure from another.
// C# public static OracleDecimal operator - (OracleDecimal val1, OracleDecimal val2);
val1
The first OracleDecimal
.
val2
The second OracleDecimal
.
A new OracleDecimal
structure.
If either operand has a null value, the returned OracleDecimal
has a null value.
This method negates the supplied OracleDecimal
structure.
// C#
public static OracleDecimal operator - (OracleDecimal val);
val
An OracleDecimal
.
A new OracleDecimal
structure.
If the supplied OracleDecimal
structure has a null value, the returned OracleDecimal
has a null value.
This method returns a new OracleDecimal
structure with its value set to the modulus of two OracleDecimal
structures.
// C# public static OracleDecimal operator % (OracleDecimal val, OracleDecimal divider);
val
An OracleDecimal
.
divider
An OracleDecimal
.
A new OracleDecimal
structure.
If either operand has a null value, the returned OracleDecimal
has a null value.
The OracleDecimal
static operators (Conversion from .NET Type to OracleDecimal
) are listed in Table 14-44.
Table 14-44 OracleDecimal Static Operators (Conversion from .NET Type to OracleDecimal)
Operator | Description |
---|---|
Converts an instance value to an |
|
Converts an instance value to an |
implicit
operator
OracleDecimal
returns the OracleDecimal
representation of a value.
implicit operator OracleDecimal(decimal)
This method returns the OracleDecimal
representation of a decimal
value.
implicit operator OracleDecimal(int)
This method returns the OracleDecimal
representation of an int
value.
implicit operator OracleDecimal(long)
This method returns the OracleDecimal
representation of a long
value.
This method returns the OracleDecimal
representation of a decimal
value.
// C#
public static implicit operator OracleDecimal(decimal val);
val
A decimal
value.
An OracleDecimal
.
This method returns the OracleDecimal
representation of an int
value.
// C#
public static implicit operator OracleDecimal(int val);
val
An int
value.
An OracleDecimal
.
This method returns the OracleDecimal
representation of a long
value.
// C#
public static implicit operator OracleDecimal(long val);
val
A long
value.
An OracleDecimal
.
OracleDecimal
returns the OracleDecimal
representation of a value.
explicit operator OracleDecimal(double)
This method returns the OracleDecimal
representation of a double.
explicit operator OracleDecimal(string)
This method returns the OracleDecimal
representation of a string.
This method returns the OracleDecimal
representation of a double.
// C#
public static explicit operator OracleDecimal(double val);
val
A double
.
An OracleDecimal
.
OverFlowException
- The value of the supplied double
is greater than the maximum value of OracleDecimal
or less than the minimum value of OracleDecimal
.
OracleDecimal
contains the following values depending on the provided double value:
double.PositiveInfinity
: positive infinity value
double.NegativeInfinity
: negative infinity value.
double.NaN
: null value
This method returns the OracleDecimal
representation of a string.
// C#
public static explicit operator OracleDecimal(string numStr);
numStr
A string
that represents a numeric value.
An OracleDecimal
.
ArgumentException
- The numStr
parameter is an invalid string representation of an OracleDecimal
.
The OracleDecimal
static operators (Conversion from OracleDecimal
to .NET) are listed in Table 14-45.
Table 14-45 OracleDecimal Static Operators (Conversion from OracleDecimal to .NET)
Operator | Description |
---|---|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
This method returns the byte
representation of the OracleDecimal
value.
// C#
public static explicit operator byte(OracleDecimal val);
val
An OracleDecimal
structure.
A byte
.
OracleNullValueException
- OracleDecimal
has a null value.
OverFlowException
- The byte
cannot represent the supplied OracleDecimal
structure.
This method returns the decimal
representation of the OracleDecimal
value.
// C#
public static explicit operator decimal(OracleDecimal val);
val
An OracleDecimal
structure.
A decimal
.
OracleNullValueException
- The OracleDecimal
has a null value.
OverFlowException
- The decimal
cannot represent the supplied OracleDecimal
structure.
This method returns the double
representation of the OracleDecimal
value.
// C#
public static explicit operator double(OracleDecimal val);
val
An OracleDecimal
structure.
A double
.
OracleNullValueException
- The OracleDecimal
has a null value.
OverFlowException
- The double
cannot represent the supplied OracleDecimal
structure.
This method returns the short
representation of the OracleDecimal
value.
// C#
public static explicit operator short(OracleDecimal val);
val
An OracleDecimal
structure.
A short
.
OracleNullValueException
- The OracleDecimal
has a null value.
OverFlowException
- The short
cannot represent the supplied OracleDecimal
structure.
This method returns the int
representation of the OracleDecimal
value.
// C#
public static explicit operator int(OracleDecimal val);
val
An OracleDecimal
structure.
An int
.
OracleNullValueException
- The OracleDecimal
has a null value.
OverFlowException
- The int
cannot represent the supplied OracleDecimal
structure.
This method returns the long
representation of the OracleDecimal
value.
// C#
public static explicit operator long(OracleDecimal val);
val
An OracleDecimal
structure.
A long
.
OracleNullValueException
- The OracleDecimal
has a null value.
OverFlowException
- The long
cannot represent the supplied OracleDecimal
structure.
This method returns the float
representation of the OracleDecimal
value.
// C#
public static explicit operator float(OracleDecimal val);
val
An OracleDecimal
structure.
A float
.
OracleNullValueException
- The OracleDecimal
has a null value.
OverFlowException
- The float
cannot represent the supplied OracleDecimal
structure.
The OracleDecimal
properties are listed in Table 14-46.
Table 14-46 OracleDecimal Properties
Properties | Description |
---|---|
Returns a byte array that represents the Oracle |
|
Specifies the format for |
|
Indicates whether or not the current instance is an integer |
|
Indicates whether or not the current instance has a null value |
|
Indicates whether or not the current instance is greater than |
|
Indicates whether or not the current instance has a |
|
Returns a |
This property returns a byte array that represents the Oracle NUMBER
in an internal Oracle format.
// C# public byte[] BinData {get;}
A byte array that represents the Oracle NUMBER
in an internal Oracle format.
OracleNullValueException
- The current instance has a null value.
This property specifies the format for ToString()
.
// C# public string Format {get; set;}
The string which specifies the format.
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:
OracleGlobalization.Currency
OracleGlobalization.ISOCurrency
OracleGlobalization.DualCurrency
This property indicates whether or not the current instance is an integer value.
// C# public bool IsInt {get;}
A bool
value that returns true
if the current instance is an integer value; otherwise, returns false
.
OracleNullValueException
- The current instance has a null value.
This property indicates whether or not the current instance has a null value.
// C# public bool IsNull {get;}
A bool
value that returns true
if the current instance has a null value; otherwise, returns false
.
This property indicates whether or not the value of the current instance is greater than 0
.
// C# public bool IsPositive {get;}
A bool
value that returns true
if the current instance is greater than 0
; otherwise, returns false
.
OracleNullValueException
- The current instance has a null value.
This property indicates whether or not the current instance has a zero value.
// C# public bool IsZero{get;}
A bool
value that returns true
if the current instance has a zero value; otherwise, returns false
.
OracleNullValueException
- The current instance has a null value.
This method returns a decimal
value.
// C# public decimal Value {get;}
A decimal
value.
OracleNullValueException
- The current instance has a null value.
OverFlowException
- The decimal
cannot represent the supplied OracleDecimal
structure.
Precision can be lost when the decimal
value is obtained from an OracleDecimal
. See Remarks under "OracleDecimal Structure" for further information.
The OracleDecimal
instance methods are listed in Table 14-47.
Table 14-47 OracleDecimal Instance Methods
Method | Description |
---|---|
Compares the current instance to the supplied object and returns an integer that represents their relative values |
|
Determines whether or not an object is an instance of |
|
Returns a hash code for the current instance |
|
GetType |
Inherited from |
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Overloads Returns the |
This method compares the current instance to the supplied object and returns an integer that represents their relative values.
// C#
public int CompareTo(object obj);
obj
The supplied instance.
The method returns a number:
Less than zero: if the value of the current instance is less than obj
.
Zero: if the value of the current instance is equal to obj
.
Greater than zero: if the value of the current instance is greater than obj
.
IComparable
ArgumentException
- The parameter is not of type OracleDecimal
.
The following rules apply to the behavior of this method.
The comparison must be between OracleDecimal
s. For example, comparing an OracleDecimal
instance with an OracleBinary
instance is not allowed. When an OracleDecimal
is compared with a different type, an ArgumentException
is thrown.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
Overrides Object
This method determines whether or not an object is an instance of OracleDecimal
, and whether or not the value of the object is equal to the current instance.
// C#
public override bool Equals(object obj);
obj
An OracleDecimal
instance.
Returns true
if obj
is an instance of OracleDecimal
, and the value of obj
is equal to the current instance; otherwise, returns false
.
The following rules apply to the behavior of this method.
Any OracleDecimal
that has a value compares greater than an OracleDecimal
that has a null value.
Two OracleDecimal
s that contain a null value are equal.
Overrides Object
This method returns a hash code for the current instance.
// C# public override int GetHashCode();
Returns a hash code.
This method returns the byte
representation of the current instance.
// C# public byte ToByte();
A byte
.
OverFlowException
- The byte
cannot represent the current instance.
OracleNullValueException
- The current instance has a null value.
This method returns the double
representation of the current instance.
// C# public double ToDouble();
A double
.
OverFlowException
- The double
cannot represent the current instance.
OracleNullValueException
- The current instance has a null value.
This method returns the Int16
representation of the current instance.
// C# public short ToInt16();
A short
.
OverFlowException
- The short
cannot represent the current instance.
OracleNullValueException
- The current instance has a null value.
This method returns the Int32
representation of the current instance.
// C# public int ToInt32();
An int
.
OverFlowException
- The int
cannot represent the current instance.
OracleNullValueException
- The current instance has a null value.
This method returns the Int64
representation of the current instance.
// C# public long ToInt64();
A long
.
OverFlowException
- The long
cannot represent the current instance.
OracleNullValueException
- The current instance has a null value.
This method returns the Single
representation of the current instance.
// C# public float ToSingle();
A float
.
OverFlowException
- The float
cannot represent the current instance.
OracleNullValueException
- The current instance has a null value.
Overrides Object
This method returns the string
representation of the current instance.
// C# public override string ToString();
Returns the number in a string.
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:
OracleGlobalization.Currency
OracleGlobalization
.ISOCurrency
OracleGlobalization
.DualCurrency
If the numeric format is not specified, an Oracle default value is used.