Skip Headers
Oracle® Data Provider for .NET Developer's Guide
11g Release 1 (11.1.0.6.20)
E10927-01
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

OracleDecimal Structure

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

Class Inheritance

System.Object

  System.ValueType

    Oracle.DataAccess.Types.OracleDecimal

Declaration

// ADO.NET 2.0: C#
 public struct OracleDecimal : IComparable, INullable, IXmlSerializable
// ADO.NET 1.x: C#public struct OracleDecimal : IComparable, INullable

Thread Safety

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

Remarks

OracleDecimal can store up to 38 precision, while the .NET Decimal 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.

Example

// 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);
  }
}

Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

Microsoft .NET Framework Version: 1.0 or later


OracleDecimal Members

OracleDecimal members are listed in the following tables:

OracleDecimal Constructors

OracleDecimal constructors are listed in Table 12-27

Table 12-27 OracleDecimal Constructors

Constructor Description

OracleDecimal Constructors

Instantiates a new instance of OracleDecimal structure (Overloaded)


OracleDecimal Static Fields

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

Table 12-28 OracleDecimal Static Fields

Field Description

MaxPrecision

A constant representing the maximum precision, which is 38

MaxScale

A constant representing the maximum scale, which is 127

MaxValue

A constant representing the maximum value for this structure, which is 9.9…9 x 10125

MinScale

A constant representing the minimum scale, which is -84

MinValue

A constant representing the minimum value for this structure, which is -1.0 x 10130

NegativeOne

A constant representing the negative one value

Null

Represents a null value that can be assigned to an OracleDecimal instance

One

A constant representing the positive one value

Pi

A constant representing the numeric Pi value

Zero

A constant representing the zero value


OracleDecimal Static (Comparison) Methods

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

Table 12-29 OracleDecimal Static (Comparison) Methods

Methods Description

Equals

Determines if two OracleDecimal values are equal (Overloaded)

GreaterThan

Determines if the first of two OracleDecimal values is greater than the second

GreaterThanOrEqual

Determines if the first of two OracleDecimal values is greater than or equal to the second

LessThan

Determines if the first of two OracleDecimal values is less than the second

LessThanOrEqual

Determines if the first of two OracleDecimal values is less than or equal to the second.

NotEquals

Determines if two OracleDecimal values are not equal


OracleDecimal Static (Manipulation) Methods

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

Table 12-30 OracleDecimal Static (Manipulation) Methods

Methods Description

Abs

Returns the absolute value of an OracleDecimal

Add

Adds two OracleDecimal structures

AdjustScale

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

Ceiling

Returns a new OracleDecimal structure with its value set to the ceiling of an OracleDecimal structure

ConvertToPrecScale

Returns a new OracleDecimal structure with a new precision and scale

Divide

Divides one OracleDecimal value by another

Floor

Returns a new OracleDecimal structure with its value set to the floor of an OracleDecimal structure

Max

Returns the maximum value of the two supplied OracleDecimal structures

Min

Returns the minimum value of the two supplied OracleDecimal structures

Mod

Returns a new OracleDecimal structure with its value set to the modulus of two OracleDecimal structures

Multiply

Returns a new OracleDecimal structure with its value set to the result of multiplying two OracleDecimal structures

Negate

Returns a new OracleDecimal structure with its value set to the negation of the supplied OracleDecimal structure

Parse

Converts a string to an OracleDecimal

Round

Returns a new OracleDecimal structure with its value set to that of the supplied OracleDecimal structure and rounded off to the specified place

SetPrecision

Returns a new OracleDecimal structure with a new specified precision.

Shift

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

Sign

Determines the sign of an OracleDecimal structure

Sqrt

Returns a new OracleDecimal structure with its value set to the square root of the supplied OracleDecimal structure

Subtract

Returns a new OracleDecimal structure with its value set to result of subtracting one OracleDecimal structure from another

Truncate

Truncates the OracleDecimal at a specified position


OracleDecimal Static (Logarithmic) Methods

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

Table 12-31 OracleDecimal Static (Logarithmic) Methods

Methods Description

Exp

Returns a new OracleDecimal structure with its value set to e raised to the supplied power

Log

Returns the supplied OracleDecimal structure with its value set to the logarithm of the supplied OracleDecimal structure (Overloaded)

Pow

Returns a new OracleDecimal structure with its value set to the supplied OracleDecimal structure raised to the supplied power (Overloaded)


OracleDecimal Static (Trigonometric) Methods

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

Table 12-32 OracleDecimal Static (Trigonometric) Methods

Methods Description

Acos

Returns an angle in radian whose cosine is the supplied OracleDecimal structure

Asin

Returns an angle in radian whose sine is the supplied OracleDecimal structure

Atan

Returns an angle in radian whose tangent is the supplied OracleDecimal structure

Atan2

Returns an angle in radian whose tangent is the quotient of the two supplied OracleDecimal structures

Cos

Returns the cosine of the supplied angle in radian

Sin

Returns the sine of the supplied angle in radian

Tan

Returns the tangent of the supplied angle in radian

Cosh

Returns the hyperbolic cosine of the supplied angle in radian

Sinh

Returns the hyperbolic sine of the supplied angle in radian

Tanh

Returns the hyperbolic tangent of the supplied angle in radian


OracleDecimal Static (Comparison) Operators

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

Table 12-33 OracleDecimal Static (Comparison) Operators

Operator Description

operator +

Adds two OracleDecimal values

operator /

Divides one OracleDecimal value by another

operator ==

Determines if the two OracleDecimal values are equal

operator >

Determines if the first of two OracleDecimal values is greater than the second

operator >=

Determines if the first of two OracleDecimal values is greater than or equal to the second

operator !=

Determines if the two OracleDecimal values are not equal

operator <

Determines if the first of two OracleDecimal values is less than the second

operator <=

Determines if the first of two OracleDecimal values is less than or equal to the second

operator *

Multiplies two OracleDecimal structures

operator -

Subtracts one OracleDecimal structure from another

operator -

Negates an OracleDecimal structure

operator%

Returns a new OracleDecimal structure with its value set to the modulus of two OracleDecimal structures.


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

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

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

Operator Description

implicit operator OracleDecimal

Converts an instance value to an OracleDecimal structure (Overloaded)

explicit operator OracleDecimal

Converts an instance value to an OracleDecimal structure (Overloaded)


OracleDecimal Static Operators (Conversion from OracleDecimal to .NET)

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

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

Operator Description

explicit operator byte

Returns the byte representation of the OracleDecimal value

explicit operator decimal

Returns the decimal representation of the OracleDecimal value

explicit operator double

Returns the double representation of the OracleDecimal value

explicit operator short

Returns the short representation of the OracleDecimal value

explicit operator int

Returns the int representation of the OracleDecimal value

explicit operator long

Returns the long representation of the OracleDecimal value

explicit operator float

Returns the float representation of the OracleDecimal value


OracleDecimal Properties

The OracleDecimal properties are listed in Table 12-36.

Table 12-36 OracleDecimal Properties

Properties Description

BinData

Returns a byte array that represents the Oracle NUMBER in Oracle internal format

Format

Specifies the format for ToString()

IsInt

Indicates whether or not the current instance is an integer

IsNull

Indicates whether or not the current instance has a null value

IsPositive

Indicates whether or not the current instance is greater than 0

IsZero

Indicates whether or not the current instance has a zero value

Value

Returns a decimal value


OracleDecimal Instance Methods

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

Table 12-37 OracleDecimal Instance Methods

Method Description

CompareTo

Compares the current instance to the supplied object and returns an integer that represents their relative values

Equals

Determines whether or not an object is an instance of OracleDecimal, and whether or not the value of the object is equal to the current instance (Overloaded)

GetHashCode

Returns a hash code for the current instance

GetType

Inherited from System.Object

ToByte

Returns the byte representation of the current instance

ToDouble

Returns the double representation of the current instance

ToInt16

Returns the Int16 representation of the current instance

ToInt32

Returns the Int32 representation of the current instance

ToInt64

Returns the Int64 representation of the current instance

ToSingle

Returns the Single representation of the current instance

ToString

Overloads Object.ToString()

Returns the string representation of the current instance



OracleDecimal Constructors

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

Overload List:

OracleDecimal(byte [ ])

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

Declaration

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

Parameters

Exceptions

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

ArgumentNullException - The bytes parameter is null.

OracleDecimal(decimal)

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

Declaration

// C#
public OracleDecimal(decimal decX); 

Parameters

OracleDecimal(double)

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

Declaration

// C#
public OracleDecimal(double doubleX)

Parameters

Exceptions

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

Remarks

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

OracleDecimal(int)

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

Declaration

// C#
public OracleDecimal(int intX);

Parameters

OracleDecimal(float)

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

Declaration

// C#
public OracleDecimal(float floatX);

Parameters

Remarks

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

float.PositiveInfinity: positive infinity value

float.NegativeInfinity: negative infinity value

float.NaN: null value

OracleDecimal(long)

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

Declaration

// C#
public OracleDecimal(long longX);

Parameters

OracleDecimal(string)

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

Declaration

// C#
public OracleDecimal(string numStr);

Parameters

Exceptions

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

ArgumentNullException - The numStr parameter is null.

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

OracleDecimal(string, string)

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

Declaration

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

Parameters

Exceptions

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

ArgumentNullException - The numStr parameter is null.

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

Remarks

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

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

Example

// C#
 
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()); 
  }
}

OracleDecimal Static Fields

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

Table 12-38 OracleDecimal Static Fields

Field Description

MaxPrecision

A constant representing the maximum precision, which is 38

MaxScale

A constant representing the maximum scale, which is 127

MaxValue

A constant representing the maximum value for this structure, which is 9.9…9 x 10125

MinScale

A constant representing the minimum scale, which is -84

MinValue

A constant representing the minimum value for this structure, which is -1.0 x 10130

NegativeOne

A constant representing the negative one value

Null

Represents a null value that can be assigned to an OracleDecimal instance

One

A constant representing the positive one value

Pi

A constant representing the numeric Pi value

Zero

A constant representing the zero value


MaxPrecision

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

Declaration

// C#
public static readonly byte MaxPrecision;

MaxScale

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

Declaration

// C#
public static readonly byte MaxScale;

MaxValue

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

Declaration

// C#
public static readonly OracleDecimal MaxValue;

MinScale

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

Declaration

// C#
public static readonly int MinScale;

MinValue

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

Declaration

// C#
public static readonly OracleDecimal MinValue;

NegativeOne

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

Declaration

// C#
public static readonly OracleDecimal NegativeOne;

Null

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

Declaration

// C#
public static readonly OracleDecimal Null;

One

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

Declaration

// C#
public static readonly OracleDecimal One;

Pi

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

Declaration

// C#
public static readonly OracleDecimal Pi;

Zero

This static field indicates a constant representing the zero value.

Declaration

// C#
public static readonly OracleDecimal Zero;

OracleDecimal Static (Comparison) Methods

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

Table 12-39 OracleDecimal Static (Comparison) Methods

Methods Description

Equals

Determines if two OracleDecimal values are equal (Overloaded)

GreaterThan

Determines if the first of two OracleDecimal values is greater than the second

GreaterThanOrEqual

Determines if the first of two OracleDecimal values is greater than or equal to the second

LessThan

Determines if the first of two OracleDecimal values is less than the second

LessThanOrEqual

Determines if the first of two OracleDecimal values is less than or equal to the second.

NotEquals

Determines if two OracleDecimal values are not equal


Equals

This method determines if two OracleDecimal values are equal.

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

GreaterThan

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

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

GreaterThanOrEqual

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

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

LessThan

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

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

LessThanOrEqual

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

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

NotEquals

This method determines if two OracleDecimal values are not equal.

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.


OracleDecimal Static (Manipulation) Methods

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

Table 12-40 OracleDecimal Static (Manipulation) Methods

Methods Description

Abs

Returns the absolute value of an OracleDecimal

Add

Adds two OracleDecimal structures

AdjustScale

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

Ceiling

Returns a new OracleDecimal structure with its value set to the ceiling of an OracleDecimal structure

ConvertToPrecScale

Returns a new OracleDecimal structure with a new precision and scale

Divide

Divides one OracleDecimal value by another

Floor

Returns a new OracleDecimal structure with its value set to the floor of an OracleDecimal structure

Max

Returns the maximum value of the two supplied OracleDecimal structures

Min

Returns the minimum value of the two supplied OracleDecimal structures

Mod

Returns a new OracleDecimal structure with its value set to the modulus of two OracleDecimal structures

Multiply

Returns a new OracleDecimal structure with its value set to the result of multiplying two OracleDecimal structures

Negate

Returns a new OracleDecimal structure with its value set to the negation of the supplied OracleDecimal structure

Parse

Converts a string to an OracleDecimal

Round

Returns a new OracleDecimal structure with its value set to that of the supplied OracleDecimal structure and rounded off to the specified place

SetPrecision

Returns a new OracleDecimal structure with a new specified precision.

Shift

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

Sign

Determines the sign of an OracleDecimal structure

Sqrt

Returns a new OracleDecimal structure with its value set to the square root of the supplied OracleDecimal structure

Subtract

Returns a new OracleDecimal structure with its value set to result of subtracting one OracleDecimal structure from another

Truncate

Truncates the OracleDecimal at a specified position


Abs

This method returns the absolute value of an OracleDecimal.

Declaration

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

Parameters

Return Value

The absolute value of an OracleDecimal.

Remarks

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

Add

This method adds two OracleDecimal structures.

Declaration

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

Parameters

Return Value

Returns an OracleDecimal structure.

Remarks

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

AdjustScale

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

Declaration

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

Parameters

Return Value

An OracleDecimal.

Remarks

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

Example

// C#
 
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()); 
  }
}

Ceiling

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

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Remarks

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

ConvertToPrecScale

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

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Remarks

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

Example

// C#
 
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()); 
  }
}

Divide

This method divides one OracleDecimal value by another.

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Remarks

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

Floor

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

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Remarks

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

Max

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure that has the greater value.

Min

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure that has the smaller value.

Mod

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

Declaration

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

Parameters

Return Value

An OracleDecimal.

Remarks

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

Multiply

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

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Remarks

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

Negate

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

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Remarks

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

Parse

This method converts a string to an OracleDecimal.

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Exceptions

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

ArgumentNullException - The numStr parameter is null.

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

Round

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure.

Remarks

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

SetPrecision

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure.

Remarks

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

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

Example

// C#
 
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()); 
  }
}

Shift

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure.

Remarks

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

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

Sign

This method determines the sign of an OracleDecimal structure.

Declaration

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

Parameters

Return Value

Exceptions

OracleNullValueException - The argument has a null value.

Sqrt

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure.

Exceptions

ArgumentOutOfRangeException - The provided OracleDecimal structure is less than zero.

Remarks

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

Subtract

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure.

Remarks

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

Truncate

This method truncates the OracleDecimal at a specified position.

Declaration

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

Parameters

Return Value

An OracleDecimal structure.

Remarks

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


OracleDecimal Static (Logarithmic) Methods

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

Table 12-41 OracleDecimal Static (Logarithmic) Methods

Methods Description

Exp

Returns a new OracleDecimal structure with its value set to e raised to the supplied power

Log

Returns the supplied OracleDecimal structure with its value set to the logarithm of the supplied OracleDecimal structure (Overloaded)

Pow

Returns a new OracleDecimal structure with its value set to the supplied OracleDecimal structure raised to the supplied power (Overloaded)


Exp

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure.

Remarks

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

Log

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

Overload List:

Log(OracleDecimal)

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

Declaration

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

Parameters

Return Value

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

Exceptions

ArgumentOutOfRangeException - The supplied OracleDecimal value is less than zero.

Remarks

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

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

Log(OracleDecimal, int)

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

Declaration

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

Parameters

Return Value

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

Exceptions

ArgumentOutOfRangeException - Either argument is less than zero.

Remarks

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

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

Log(OracleDecimal, OracleDecimal)

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

Declaration

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

Parameters

Return Value

Returns the logarithm of val in the supplied base.

Exceptions

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

Remarks

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

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

Pow

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

Overload List:

Pow(OracleDecimal, int)

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure.

Remarks

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

Pow(OracleDecimal, OracleDecimal)

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure.

Remarks

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


OracleDecimal Static (Trigonometric) Methods

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

Table 12-42 OracleDecimal Static (Trigonometric) Methods

Methods Description

Acos

Returns an angle in radian whose cosine is the supplied OracleDecimal structure

Asin

Returns an angle in radian whose sine is the supplied OracleDecimal structure

Atan

Returns an angle in radian whose tangent is the supplied OracleDecimal structure

Atan2

Returns an angle in radian whose tangent is the quotient of the two supplied OracleDecimal structures

Cos

Returns the cosine of the supplied angle in radian

Sin

Returns the sine of the supplied angle in radian

Tan

Returns the tangent of the supplied angle in radian

Cosh

Returns the hyperbolic cosine of the supplied angle in radian

Sinh

Returns the hyperbolic sine of the supplied angle in radian

Tanh

Returns the hyperbolic tangent of the supplied angle in radian


Acos

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure that represents an angle in radian.

Remarks

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

Asin

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure that represents an angle in radian.

Remarks

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

Atan

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure that represents an angle in radian.

Remarks

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

Atan2

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure that represents an angle in radian.

Remarks

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

Cos

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

Declaration

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

Parameters

Return Value

An OracleDecimal instance.

Exceptions

ArgumentOutOfRangeException - The val parameter is positive or negative infinity.

Remarks

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

Sin

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

Declaration

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

Parameters

Return Value

An OracleDecimal structure that represents an angle in radian.

Exceptions

ArgumentOutOfRangeException - The val parameter is positive or negative infinity.

Remarks

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

Tan

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

Declaration

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

Parameters

Return Value

An OracleDecimal instance.

Exceptions

ArgumentOutOfRangeException - The val parameter is positive or negative infinity.

Remarks

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

Cosh

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

Declaration

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

Parameters

Return Value

An OracleDecimal instance.

Remarks

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

Sinh

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

Declaration

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

Parameters

Return Value

An OracleDecimal instance.

Remarks

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

Tanh

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

Declaration

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

Parameters

Return Value

An OracleDecimal instance.

Remarks

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


OracleDecimal Static (Comparison) Operators

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

Table 12-43 OracleDecimal Static (Comparison) Operators

Operator Description

operator +

Adds two OracleDecimal values

operator /

Divides one OracleDecimal value by another

operator ==

Determines if the two OracleDecimal values are equal

operator >

Determines if the first of two OracleDecimal values is greater than the second

operator >=

Determines if the first of two OracleDecimal values is greater than or equal to the second

operator !=

Determines if the two OracleDecimal values are not equal

operator <

Determines if the first of two OracleDecimal values is less than the second

operator <=

Determines if the first of two OracleDecimal values is less than or equal to the second

operator *

Multiplies two OracleDecimal structures

operator -

Subtracts one OracleDecimal structure from another

operator -

Negates an OracleDecimal structure

operator%

Returns a new OracleDecimal structure with its value set to the modulus of two OracleDecimal structures.


operator +

This method adds two OracleDecimal values.

Declaration

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

Parameters

Return Value

An OracleDecimal structure.

Remarks

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

operator /

This method divides one OracleDecimal value by another.

Declaration

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

Parameters

The second OracleDecimal.

Return Value

An OracleDecimal structure.

Remarks

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

operator ==

This method determines if two OracleDecimal values are equal.

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

operator >

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

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

operator >=

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

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

operator !=

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

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

operator <

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

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

operator <=

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

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

operator *

This method multiplies two OracleDecimal structures.

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Remarks

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

operator -

This method subtracts one OracleDecimal structure from another.

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Remarks

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

operator -

This method negates the supplied OracleDecimal structure.

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Remarks

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

operator%

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

Declaration

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

Parameters

Return Value

A new OracleDecimal structure.

Remarks

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


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

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

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

Operator Description

implicit operator OracleDecimal

Converts an instance value to an OracleDecimal structure (Overloaded)

explicit operator OracleDecimal

Converts an instance value to an OracleDecimal structure (Overloaded)


implicit operator OracleDecimal

implicit operator OracleDecimal returns the OracleDecimal representation of a value.

Overload List:

implicit operator OracleDecimal(decimal)

This method returns the OracleDecimal representation of a decimal value.

Declaration

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

Parameters

Return Value

An OracleDecimal.

implicit operator OracleDecimal(int)

This method returns the OracleDecimal representation of an int value.

Declaration

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

Parameters

Return Value

An OracleDecimal.

implicit operator OracleDecimal(long)

This method returns the OracleDecimal representation of a long value.

Declaration

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

Parameters

Return Value

An OracleDecimal.

explicit operator OracleDecimal

OracleDecimal returns the OracleDecimal representation of a value.

Overload List:

explicit operator OracleDecimal(double)

This method returns the OracleDecimal representation of a double.

Declaration

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

Parameters

Return Value

An OracleDecimal.

Exceptions

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

Remarks

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

explicit operator OracleDecimal(string)

This method returns the OracleDecimal representation of a string.

Declaration

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

Parameters

Return Value

An OracleDecimal.

Exceptions

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


OracleDecimal Static Operators (Conversion from OracleDecimal to .NET)

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

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

Operator Description

explicit operator byte

Returns the byte representation of the OracleDecimal value

explicit operator decimal

Returns the decimal representation of the OracleDecimal value

explicit operator double

Returns the double representation of the OracleDecimal value

explicit operator short

Returns the short representation of the OracleDecimal value

explicit operator int

Returns the int representation of the OracleDecimal value

explicit operator long

Returns the long representation of the OracleDecimal value

explicit operator float

Returns the float representation of the OracleDecimal value


explicit operator byte

This method returns the byte representation of the OracleDecimal value.

Declaration

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

Parameters

Return Value

A byte.

Exceptions

OracleNullValueException - OracleDecimal has a null value.

OverFlowException- The byte cannot represent the supplied OracleDecimal structure.

explicit operator decimal

This method returns the decimal representation of the OracleDecimal value.

Declaration

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

Parameters

Return Value

A decimal.

Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The decimal cannot represent the supplied OracleDecimal structure.

explicit operator double

This method returns the double representation of the OracleDecimal value.

Declaration

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

Parameters

Return Value

A double.

Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The double cannot represent the supplied OracleDecimal structure.

explicit operator short

This method returns the short representation of the OracleDecimal value.

Declaration

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

Parameters

Return Value

A short.

Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The short cannot represent the supplied OracleDecimal structure.

explicit operator int

This method returns the int representation of the OracleDecimal value.

Declaration

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

Parameters

Return Value

An int.

Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The int cannot represent the supplied OracleDecimal structure.

explicit operator long

This method returns the long representation of the OracleDecimal value.

Declaration

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

Parameters

Return Value

A long.

Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The long cannot represent the supplied OracleDecimal structure.

explicit operator float

This method returns the float representation of the OracleDecimal value.

Declaration

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

Parameters

Return Value

A float.

Exceptions

OracleNullValueException - The OracleDecimal has a null value.

OverFlowException - The float cannot represent the supplied OracleDecimal structure.


OracleDecimal Properties

The OracleDecimal properties are listed in Table 12-46.

Table 12-46 OracleDecimal Properties

Properties Description

BinData

Returns a byte array that represents the Oracle NUMBER in Oracle internal format

Format

Specifies the format for ToString()

IsInt

Indicates whether or not the current instance is an integer

IsNull

Indicates whether or not the current instance has a null value

IsPositive

Indicates whether or not the current instance is greater than 0

IsZero

Indicates whether or not the current instance has a zero value

Value

Returns a decimal value


BinData

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

Declaration

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

Property Value

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

Exceptions

OracleNullValueException - The current instance has a null value.

Format

This property specifies the format for ToString().

Declaration

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

Property Value

The string which specifies the format.

Remarks

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

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

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

The currency symbols are specified by the following thread properties:

IsInt

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

Declaration

// C#
public bool IsInt {get;}

Property Value

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

Exceptions

OracleNullValueException - The current instance has a null value.

IsNull

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

Declaration

// C#
public bool IsNull {get;}

Property Value

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

IsPositive

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

Declaration

// C#
public bool IsPositive {get;}

Property Value

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

Exceptions

OracleNullValueException - The current instance has a null value.

IsZero

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

Declaration

// C#
public bool IsZero{get;}

Property Value

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

Exceptions

OracleNullValueException - The current instance has a null value.

Value

This method returns a decimal value.

Declaration

// C#
public decimal Value {get;}

Property Value

A decimal value.

Exceptions

OracleNullValueException - The current instance has a null value.

OverFlowException - The decimal cannot represent the supplied OracleDecimal structure.

Remarks

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


OracleDecimal Instance Methods

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

Table 12-47 OracleDecimal Instance Methods

Method Description

CompareTo

Compares the current instance to the supplied object and returns an integer that represents their relative values

Equals

Determines whether or not an object is an instance of OracleDecimal, and whether or not the value of the object is equal to the current instance (Overloaded)

GetHashCode

Returns a hash code for the current instance

GetType

Inherited from System.Object

ToByte

Returns the byte representation of the current instance

ToDouble

Returns the double representation of the current instance

ToInt16

Returns the Int16 representation of the current instance

ToInt32

Returns the Int32 representation of the current instance

ToInt64

Returns the Int64 representation of the current instance

ToSingle

Returns the Single representation of the current instance

ToString

Overloads Object.ToString()

Returns the string representation of the current instance


CompareTo

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

Declaration

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

Parameters

Return Value

The method returns a number:

Implements

IComparable

Exceptions

ArgumentException - The parameter is not of type OracleDecimal.

Remarks

The following rules apply to the behavior of this method.

Equals

Overrides Object

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

Declaration

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

Parameters

Return Value

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

Remarks

The following rules apply to the behavior of this method.

GetHashCode

Overrides Object

This method returns a hash code for the current instance.

Declaration

// C#
public override int GetHashCode();

Return Value

Returns a hash code.

ToByte

This method returns the byte representation of the current instance.

Declaration

// C#
public byte ToByte();

Return Value

A byte.

Exceptions

OverFlowException - The byte cannot represent the current instance.

OracleNullValueException - The current instance has a null value.

ToDouble

This method returns the double representation of the current instance.

Declaration

// C#
public double ToDouble();

Return Value

A double.

Exceptions

OverFlowException - The double cannot represent the current instance.

OracleNullValueException - The current instance has a null value.

ToInt16

This method returns the Int16 representation of the current instance.

Declaration

// C#
public short ToInt16();

Return Value

A short.

Exceptions

OverFlowException - The short cannot represent the current instance.

OracleNullValueException - The current instance has a null value.

ToInt32

This method returns the Int32 representation of the current instance.

Declaration

// C#
public int ToInt32();

Return Value

An int.

Exceptions

OverFlowException - The int cannot represent the current instance.

OracleNullValueException - The current instance has a null value.

ToInt64

This method returns the Int64 representation of the current instance.

Declaration

// C#
public long ToInt64();

Return Value

A long.

Exceptions

OverFlowException - The long cannot represent the current instance.

OracleNullValueException - The current instance has a null value.

ToSingle

This method returns the Single representation of the current instance.

Declaration

// C#
public float ToSingle();

Return Value

A float.

Exceptions

OverFlowException - The float cannot represent the current instance.

OracleNullValueException - The current instance has a null value.

ToString

Overrides Object

This method returns the string representation of the current instance.

Declaration

// C#
public override string ToString();

Return Value

Returns the number in a string.

Remarks

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

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

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

The currency symbols are specified by the following thread properties:

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