| Oracle® Data Provider for .NET Developer's Guide Release 9.2.0.4 Part Number B10961-01 |
|
Oracle.DataAccess.Types Namespace (ODP.NET Types), 4 of 19
The OracleDecimal structure represents an Oracle NUMBER in the database or any Oracle numeric value.
Object
ValueType
OracleDecimal
// C# public struct OracleDecimal : IComparable
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 datatype can only hold up to 28 precision. When accessing the OracleDecimal.Value property from an OracleDecimal that has a value greater than 28 precision, loss of precision can occur. To retrieve the actual value of OracleDecimal, use the OracleDecimal.ToString() method. Another approach is to obtain the OracleDecimal value as a byte array in an internal Oracle NUMBER format through the BinData property.
// C# // Illustrates the usage of OracleDecimal OracleDecimal pi = OracleDecimal.Pi; // Use of implicit operator OracleDecimal(int) OracleDecimal approxPi = OracleDecimal.Divide(22,7); // Round the difference to 5 decimal places OracleDecimal diff=OracleDecimal.Round(OracleDecimal.Abs(pi -approxPi),5); // Set the format for ToString() - display with trailing zeroes diff.Format = "9.9999900"; Console.WriteLine(diff.ToString());
Namespace: Oracle.DataAccess.Types
Assembly: Oracle.DataAccess.dll
OracleDecimal members are listed in the following tables:
OracleDecimal constructors are listed in Table 5-27
| Constructor | Description |
|---|---|
|
Instantiates a new instance of OracleDecimal structure (Overloaded) |
The OracleDecimal static fields are listed in Table 5-28.
The OracleDecimal static (comparison) methods are listed in Table 5-29.
The OracleDecimal static (manipulation) methods are listed in Table 5-30.
The OracleDecimal static (logarithmic) methods are listed in Table 5-31.
The OracleDecimal static (trigonometric) methods are listed in Table 5-32.
The OracleDecimal static (comparison) operators are listed in Table 5-33.
The OracleDecimal static operators (Conversion from .NET Type to OracleDecimal) are listed in Table 5-34.
| Operator | Description |
|---|---|
|
Converts an instance value to an |
|
|
Converts an instance value to an |
The OracleDecimal static operators (Conversion from OracleDecimal to .NET) are listed in Table 5-35.
The OracleDecimal properties are listed in Table 5-36.
The OracleDecimal instance methods are listed in Table 5-37.
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);
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);
This constructor creates a new instance of the OracleDecimal structure and sets its value to the supplied double value.
// C# public OracleDecimal(double doubleX)
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);
This constructor creates a new instance of the OracleDecimal structure and sets its value to the supplied Single value.
// C# public OracleDecimal(float floatX);
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);
This constructor creates a new instance of the OracleDecimal structure and sets its value to the supplied string value.
// C# public OracleDecimal(string numStr);
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);
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# // Set the nls parameters to be used in the numeric format OracleGlobalization og = OracleGlobalization.GetClientInfo(); og.Currency = "$"; og.NumericCharacters = ".,"; OracleGlobalization.SetThreadInfo(og); // Construct an OracleDecimal using a valid numeric format OracleDecimal od = new OracleDecimal("$2,222.22","L9G999D99"); Console.WriteLine(od.ToString()); // Prints $2,222.22
The OracleDecimal static fields are listed in Table 5-38.
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;
This static field indicates a constant representing the zero value.
// C# public static readonly OracleDecimal Zero;
The OracleDecimal static (comparison) methods are listed in Table 5-39.
This method determines if two OracleDecimal values are equal.
// C# public static bool Equals(OracleDecimal value1, OracleDecimal value2);
Returns true if two OracleDecimal values are equal; otherwise, returns false.
The following rules apply to the behavior of this method.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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);
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.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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);
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.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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);
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.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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);
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.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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);
Returns true if two OracleDecimal values are not equal; otherwise, returns false.
The following rules apply to the behavior of this method.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals that contain a null value are equal.
The OracleDecimal static (manipulation) methods are listed in Table 5-40.
This method returns the absolute value of an OracleDecimal.
// C# public static OracleDecimal Abs(OracleDecimal val);
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);
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 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# OracleDecimal od = new OracleDecimal(5.555); // Adjust Scale to 2 with rounding off OracleDecimal odr = OracleDecimal.AdjustScale(od, 2, true); Console.WriteLine(odr.ToString()); // Prints 5.56 // Adjust Scale to 2 with truncation OracleDecimal odt = OracleDecimal.AdjustScale(od, 2, false); Console.WriteLine(odt.ToString()); // Prints 5.55
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);
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# OracleDecimal od = new OracleDecimal(555.6666); // Set the precision of od to 5 and scale to 2 OracleDecimal odp5s2 = OracleDecimal.ConvertToPrecScale(od,5,2); Console.WriteLine(odp5s2.ToString()); // Prints 555.67 // Set the precision of od to 3 and scale to 0 OracleDecimal odp3s0 = OracleDecimal.ConvertToPrecScale(od,3,0); Console.WriteLine(odp3s0.ToString()); // Prints 556
This method divides one OracleDecimal value by another.
// C# public static OracleDecimal Divide(OracleDecimal val1, OracleDecimal val2);
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);
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);
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);
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);
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);
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);
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);
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);
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# OracleDecimal od = new OracleDecimal(555.6666); // Set the precision of od to 3 OracleDecimal odp3 = OracleDecimal.SetPrecision(od,3); Console.WriteLine(odp3.ToString()); // Prints 556 // Set the precision of od to 4 OracleDecimal odp4 = OracleDecimal.SetPrecision(od,4); Console.WriteLine(odp4.ToString()); // Prints 555.7
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);
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);
-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);
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);
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 5-41.
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);
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.
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);
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.
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);
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);
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 5-42.
This method returns an angle in radian whose cosine is the supplied OracleDecimal structure.
// C# public static OracleDecimal Acos(OracleDecimal val);
An OracleDecimal structure that represents an angle in radian.
If either argument has a null value, the returned OracleDecimal has a null value.
This method returns an angle in radian whose sine is the supplied OracleDecimal structure.
// C# public static OracleDecimal Asin(OracleDecimal val);
An OracleDecimal structure that represents an angle in radian.
If either argument has a null value, the returned OracleDecimal has a null value.
This method returns an angle in radian whose tangent is the supplied OracleDecimal structure
// C# public static OracleDecimal Atan(OracleDecimal val);
An OracleDecimal structure that represents an angle in radian.
If the argument has a null value, the returned OracleDecimal has a null value.
This method returns an angle in radian 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 radian.
If either argument has a null value, the returned OracleDecimal has a null value.
This method returns the cosine of the supplied angle in radian.
// C# public static OracleDecimal Cos(OracleDecimal val);
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 radian.
// C# public static OracleDecimal Sin(OracleDecimal val);
An OracleDecimal structure that represents an angle in radian.
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 radian.
// C# public static OracleDecimal Tan(OracleDecimal val);
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 radian.
// C# public static OracleDecimal Cosh(OracleDecimal val);
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 radian.
// C# public static OracleDecimal Sinh(OracleDecimal val);
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 radian.
// C# public static OracleDecimal Tanh(OracleDecimal val);
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 5-43.
This method adds two OracleDecimal values.
// C# public static OracleDecimal operator + (OracleDecimal val1, OracleDecimal val2);
An OracleDecimal structure.
If either operand has a null value, the returned OracleDecimal has a null value.
This method divides one OracleDecimalvalue by another.
// C# public static OracleDecimal operator / (OracleDecimal val1, OracleDecimal val2);
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);
Returns true if their values are equal; otherwise, returns false.
The following rules apply to the behavior of this method.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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);
Returns true if the two OracleDecimal values are not equal; otherwise, returns false.
The following rules apply to the behavior of this method.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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);
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.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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);
Returns true if the two OracleDecimal values are not equal; otherwise, returns false.
The following rules apply to the behavior of this method.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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);
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.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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);
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.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals that contain a null value are equal.
This method multiplies two OracleDecimal structures.
// C# public static OracleDecimal operator * (OracleDecimal val1, OracleDecimal val2);
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);
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);
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);
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 5-44.
| Operator | Description |
|---|---|
|
Converts an instance value to an |
|
|
Converts an instance value to an |
implicit operator OracleDecimal returns the OracleDecimal representation of a value.
This method returns the OracleDecimal representation of a decimal value.
This method returns the OracleDecimal representation of an int value.
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);
An OracleDecimal.
This method returns the OracleDecimal representation of an int value.
// C# public static implicit operator OracleDecimal(int val);
An OracleDecimal.
This method returns the OracleDecimal representation of a long value.
// C# public static implicit operator OracleDecimal(long val);
An OracleDecimal.
OracleDecimal returns the OracleDecimal representation of a value.
This method returns the OracleDecimal representation of a double.
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);
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);
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 5-45.
This method returns the byte representation of the OracleDecimal value.
// C# public static explicit operator byte(OracleDecimal val);
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);
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);
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);
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);
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);
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);
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 5-46.
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:
This property indicates whether 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 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 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 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 5-47.
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);
The method returns a number:
obj.
obj.
obj.
IComparable
ArgumentException - The parameter is not of type OracleDecimal.
The following rules apply to the behavior of this method.
OracleDecimals. 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.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals that contain a null value are equal.
Overrides Object
This method determines whether an object is an instance of OracleDecimal, and whether the value of the object is equal to the current instance.
// C# public override bool Equals(object obj);
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.
OracleDecimal that has a value compares greater than an OracleDecimal that has a null value.
OracleDecimals 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:
If the numeric format is not specified, an Oracle default value is used.
|
|
![]() Copyright © 2002, 2003 Oracle Corporation. All Rights Reserved. |
|