Oracle JDBC API Reference
11g Release 2 ("11.2.0.3.0")

oracle.sql
Class NUMBER

java.lang.Object
  extended by oracle.sql.Datum
      extended by oracle.sql.NUMBER
All Implemented Interfaces:
java.io.Serializable

public class NUMBER
extends Datum

NUMBER Class

The NUMBER class provides converisons between the Oracle Number (lnxnum_t) data type and Java types byte[], byte, short, integer, long, float, double, String, BigInteger. and BigDecimal.

The internal data for this object is stored as a byte array in the super class' storage area.

Static methods are used for conversions.

The LNX length included format is not supported. The byte array passed to or returned by any method is assumed to have the proper length accessible by the byte[].length instance variable.

See Also:
Serialized Form

Constructor Summary
NUMBER()
          Constructs a NUMBER object initialized to zero.
NUMBER(java.math.BigDecimal BigDecNum)
          Constructs a NUMBER object initialized to the specified BigDecimal value.
NUMBER(java.math.BigInteger BigIntNum)
          Constructs a NUMBER object initialized to the specified BigInteger value.
NUMBER(boolean boolNum)
          Constructs a Number object initialized to the specified boolean value.
NUMBER(byte byteNum)
          Constructs a Number object initialized to the specified byte value.
NUMBER(byte[] num)
          Constructs a NUMBER object initialized to the value specified by the byte array.
NUMBER(double doubleNum)
          Constructs a Number object initialized to the specified double value.
NUMBER(float floatNum)
          Constructs a Number object initialized to the specified float value.
NUMBER(int intNum)
          Constructs a Number object initialized to the specified integer value.
NUMBER(long longNum)
          Constructs a Number object initialized to the specified long value.
NUMBER(java.lang.Object obj)
          Constructs a NUMBER object initialized to the value specified by the object
NUMBER(short shortNum)
          Constructs a Number object initialized to the specified short value.
NUMBER(java.lang.String StringNum, int scale)
          Constructs a NUMBER object initialized to the specified String value.
 
Method Summary
 NUMBER abs()
          Returns a new NUMBER object initialized to the absolute value of NUMBER.
 NUMBER acos()
          Returns a new NUMBER object initialized to the arc cosine value of NUMBER.
 NUMBER add(NUMBER n)
          Returns a new NUMBER object initialized to the value of the addition of the NUMBER value and n.
 NUMBER asin()
          Returns a new NUMBER object initialized to the arc sine value of NUMBER.
 NUMBER atan()
          Returns a new NUMBER object initialized to the arc tangent value of NUMBER.
 NUMBER atan2(NUMBER x)
          Returns a new NUMBER object initialized to the value of atan2(NUMBER/x).
 java.math.BigDecimal bigDecimalValue()
          Calls toBigDecimalto convert internal Oracle Number into a Java BigDecimal.
 java.math.BigInteger bigIntegerValue()
          Calls toBigInteger to convert internal Oracle Number to a Java BigInteger.
 boolean booleanValue()
          Calls toBoolean to convert internal Oracle Number to a Java boolean.
 byte byteValue()
          Calls toByte to convert internal Oracle Number to a Java byte.
 NUMBER ceil()
          Returns a new NUMBER object initialized to the ceiling of NUMBER value.
 int compareTo(NUMBER n)
          Returns -1 if NUMBER is less than n, 0 if NUMBER and n are equal (==), 1 if NUMBER is greater than n.
 NUMBER cos()
          Returns a new NUMBER object initialized to the cosine value of NUMBER.
 NUMBER cosh()
          Returns a new NUMBER object initialized to the hyperbolic cosine value of NUMBER.
 NUMBER decrement()
          Returns a new NUMBER object initialized to the NUMBER value decremented by 1.
 NUMBER div(NUMBER n)
          Returns a new NUMBER object initialized to the division of NUMBER value by n.
 double doubleValue()
          Calls toDouble to convert internal Oracle Number to a Java double.
static NUMBER e()
          Returns a new NUMBER object initialized to the value of e.
 NUMBER exp()
          Returns a new NUMBER object initialized to the value of e raised to NUMBER value.
 NUMBER floatingPointRound(int precision)
          Returns a new NUMBER object initialized to Number rounded to precision significant decimal digits.
 float floatValue()
          Calls toFloat to convert internal Oracle Number to a Java float.
 NUMBER floor()
          Returns a new NUMBER object initialized to the floor of NUMBER value.
static NUMBER formattedTextToNumber(java.lang.String num, java.lang.String fmt, java.lang.String lang)
          Returns a NUMBER converted from Num controlled by the format fmt.
 NUMBER increment()
          Returns a new NUMBER object initialized to the NUMBER value incremented by 1.
 int intValue()
          Calls toInt to convert internal Oracle Number to a Java int.
 boolean isConvertibleTo(java.lang.Class cls)
          Determines if the object can be converted to a particular class
 boolean isInf()
          Returns true if NUMBER value is positive or negative infinity and a false otherwise.
 boolean isInt()
          Returns true if NUMBER value is finite and integral.
 boolean isNegInf()
          Returns returns true if NUMBER is negative infinity and false otherwise.
 boolean isPosInf()
          Returns true if NUMBER is positive infinity and false otherwise.
static boolean isValid(byte[] num)
          Checks if a given Oracle Number is valid
 boolean isZero()
          Returns true if NUMBER is zero.
 NUMBER ln()
          Returns a new NUMBER object initialized to the natural logarithm of the NUMBER value.
static NUMBER ln10()
          Returns a new NUMBER object initialized to the value of ln(10).
 NUMBER log(NUMBER base)
          Returns a new NUMBER object initialized to the logarithm to the base base of the NUMBER value.
 long longValue()
          Calls toLong to convert internal Oracle Number to a Java long.
 java.lang.Object makeJdbcArray(int arraySize)
          Returns a JDBC array representation of the datum
 NUMBER mod(NUMBER n)
          Returns a new NUMBER object initialized to the remainder of the division of NUMBER/n.
 NUMBER mul(NUMBER n)
          Returns a new NUMBER object initialized to product of NUMBER and n.
 NUMBER negate()
          Returns a new NUMBER object initialized to the negated NUMBER value.
static NUMBER negInf()
          Returns a new NUMBER object initialized to negative infinity.
static NUMBER pi()
          Returns a new NUMBER object initialized to the value of pi.
static NUMBER posInf()
          Returns a new NUMBER object initialized to positive infinity.
 NUMBER pow(int exp)
          Returns a new NUMBER object initialized to NUMBER value raised to the exp power.
 NUMBER pow(NUMBER exp)
          Returns a new NUMBER object initialized to the value of NUMBER value raised to the exp power.
 NUMBER round(int decimal_place)
          Returns a new NUMBER object initialized to the NUMBER value rounded to specified decimal place decimal_place.
 NUMBER scale(int left, int right, boolean[] big)
          Returns a new NUMBER object initialized to the value determined by the rounding performed based on the right parameter below.
 NUMBER shift(int digits)
          Returns a new NUMBER object initialized the NUMBER value shifted digits decimal places.
 short shortValue()
          Calls toShort to convert internal Oracle Number to a Java short.
 int sign()
          Returns -1 if the sign of NUMBER is negative, 0 if NUMBER is 0, and > 0 if NUMBER is positive.
 NUMBER sin()
          Returns a new NUMBER object initialized to the sine of the NUMBER.
 NUMBER sinh()
          Returns a new NUMBER object initialized to the hyperbolic sine of NUMBER.
 NUMBER sqroot()
          Returns a new NUMBER object initialized to the square root of NUMBER.
 java.lang.String stringValue()
          Calls toString to convert internal Oracle Number to a Java String.
 NUMBER sub(NUMBER n)
          Returns a new NUMBER object initialized to the difference of NUMBER and n.
 NUMBER tan()
          Returns a new NUMBER object initialized to the tangent of NUMBER.
 NUMBER tanh()
          Returns a new NUMBER object initialized to the hyperbolic tangent of Number.
static NUMBER textToPrecisionNumber(java.lang.String num, boolean precflag, int preclen, boolean scaleflag, int scalelen, java.lang.String lang)
          Returns a NUMBER object initialized to the value in num as described below.
static java.math.BigDecimal toBigDecimal(byte[] num)
          Converts an Oracle Number into a Java BigDecimal.
static java.math.BigInteger toBigInteger(byte[] num)
          Converts an Oracle Number into a Java BigInteger.
static boolean toBoolean(byte[] num)
          Convert an Oracle Number to a Java boolean.
static byte toByte(byte[] num)
          Converts an Oracle Number into a Java byte.
 byte[] toBytes()
          Returns the internal Oracle Number byte array.
static byte[] toBytes(java.math.BigDecimal BigDecNum)
          Converts a Java BigDecimal to an Oracle Number byte array.
static byte[] toBytes(java.math.BigInteger BigIntNum)
          Converts a Java BigInteger to an Oracle Number byte array.
static byte[] toBytes(boolean boolNum)
          Converts a Java boolean to an Oracle Number byte array.
static byte[] toBytes(byte byteNum)
          Converts a Java byte to an Oracle Number byte array.
static byte[] toBytes(double doubleNum)
          Converts a Java double to an Oracle Number byte array.
static byte[] toBytes(float floatNum)
          Converts a Java float to an Oracle Number byte array.
static byte[] toBytes(int intNum)
          Converts a Java int to an Oracle Number byte array.
static byte[] toBytes(long longNum)
          Converts a Java long to an Oracle Number byte array.
static byte[] toBytes(short shortNum)
          Converts a Java short to an Oracle Number byte array.
static byte[] toBytes(java.lang.String StringNum, int scale)
          Converts a Java String to an Oracle Number byte array.
static double toDouble(byte[] num)
          Converts an Oracle Number into a Java double.
static float toFloat(byte[] num)
          Converts an Oracle Number into a Java float.
 java.lang.String toFormattedText(java.lang.String fmt, java.lang.String lang)
          Returns a new String based on the format specified in fmt and NUMBER.
static int toInt(byte[] num)
          Converts an Oracle Number into a Java int.
 java.lang.Object toJdbc()
          Returns the JDBC representation of the datum object
static long toLong(byte[] num)
          Converts an Oracle Number into a Java long.
static short toShort(byte[] num)
          Converts an Oracle Number into a Java xemacs short.
static java.lang.String toString(byte[] num)
          Convert an Oracle Number to a Java String.
 java.lang.String toText(int outStringLength, java.lang.String lang)
          Returns a String with the unformatted representation of NUMBER.
 NUMBER truncate(int decimal_place)
          Returns a new NUMBER object initialized to the NUMBER value truncated to specified decimal place decimal_place.
static NUMBER zero()
          Returns a new NUMBER object initialized to zero.
 
Methods inherited from class oracle.sql.Datum
asciiStreamValue, binaryStreamValue, characterStreamValue, dateValue, equals, getBytes, getLength, getStream, setBytes, setShareBytes, shareBytes, stringValue, timestampValue, timestampValue, timeValue, timeValue
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NUMBER

public NUMBER()
Constructs a NUMBER object initialized to zero.


NUMBER

public NUMBER(byte[] num)
Constructs a NUMBER object initialized to the value specified by the byte array. Assumes length separate format where a.length is the length of the Oracle Number in bytes.

Parameters:
num - Oracle Number in byte array format

NUMBER

public NUMBER(byte byteNum)
Constructs a Number object initialized to the specified byte value.

Parameters:
byteNum - The Java byte value

NUMBER

public NUMBER(int intNum)
Constructs a Number object initialized to the specified integer value.

Parameters:
intNum - The Java integer value

NUMBER

public NUMBER(long longNum)
Constructs a Number object initialized to the specified long value.

Parameters:
longNum - The Java long value

NUMBER

public NUMBER(short shortNum)
Constructs a Number object initialized to the specified short value.

Parameters:
shortNum - The Java short value

NUMBER

public NUMBER(float floatNum)
Constructs a Number object initialized to the specified float value.

Parameters:
floatNum - The Java float value

NUMBER

public NUMBER(double doubleNum)
       throws java.sql.SQLException
Constructs a Number object initialized to the specified double value.

Parameters:
doubleNum - The Java double value
Throws:
java.sql.SQLException - on over/underflow of the Oracle Number exponent and on overflow of the mantissa.

NUMBER

public NUMBER(java.math.BigDecimal BigDecNum)
       throws java.sql.SQLException
Constructs a NUMBER object initialized to the specified BigDecimal value. Throws a SQLException on over/underflow of the exponent and/or mantissa.

Since there doesn't seem to be a way to represent +-inf using a BigDecimal this condition isn't considered.

Notes:

Parameters:
BigDecNum - The BigDecimal used to initialize NUMBER.
Throws:
java.sql.SQLException - on over/underflow of the Oracle Number exponent and on overflow of the mantissa.

NUMBER

public NUMBER(java.math.BigInteger BigIntNum)
       throws java.sql.SQLException
Constructs a NUMBER object initialized to the specified BigInteger value. Throws a SQLException on overflow of the exponent and/or mantissa.

Parameters:
BigIntNum - The Java BigInteger from which to construct the Oracle number.
Throws:
java.sql.SQLException - on overflow of the Oracle Number exponent and on overflow of the mantissa.

NUMBER

public NUMBER(java.lang.String StringNum,
              int scale)
       throws java.sql.SQLException
Constructs a NUMBER object initialized to the specified String value. Throws a SQLException on overflow of the exponent and/or mantissa.

Parameters:
StringNum - The Java String from which to construct the Oracle number.
scale - scale to use
Throws:
java.sql.SQLException - on over/underflow of the Oracle Number exponent and on overflow of the mantissa.

NUMBER

public NUMBER(boolean boolNum)
Constructs a Number object initialized to the specified boolean value.

Parameters:
boolNum - The Java boolean value

NUMBER

public NUMBER(java.lang.Object obj)
       throws java.sql.SQLException
Constructs a NUMBER object initialized to the value specified by the object

Parameters:
obj - Object value
Throws:
java.sql.SQLException - if initialization is not allowed
Method Detail

toDouble

public static double toDouble(byte[] num)
Converts an Oracle Number into a Java double. The resultant double will be rounded on loss of precision. Note that the exponent range of an IEEE double is greater than that of an Oracle number so an exponent over/underflow cannot occur.

Parameters:
num - Oracle Number in byte array format
Returns:
a Java double value

toFloat

public static float toFloat(byte[] num)
Converts an Oracle Number into a Java float.

Parameters:
num - Oracle Number in byte array format
Returns:
a Java float value

toLong

public static long toLong(byte[] num)
                   throws java.sql.SQLException
Converts an Oracle Number into a Java long.

Parameters:
num - Oracle Number in byte array format
Returns:
a Java long value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

toInt

public static int toInt(byte[] num)
                 throws java.sql.SQLException
Converts an Oracle Number into a Java int.

Parameters:
num - Oracle Number in byte array format
Returns:
a Java int value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

toShort

public static short toShort(byte[] num)
                     throws java.sql.SQLException
Converts an Oracle Number into a Java xemacs short.

Parameters:
num - Oracle Number in byte array format
Returns:
a Java short value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

toByte

public static byte toByte(byte[] num)
                   throws java.sql.SQLException
Converts an Oracle Number into a Java byte.

Parameters:
num - Oracle Number in byte array format
Returns:
a Java byte value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

toBigInteger

public static java.math.BigInteger toBigInteger(byte[] num)
                                         throws java.sql.SQLException
Converts an Oracle Number into a Java BigInteger.

Parameters:
num - Oracle Number in byte array format
Returns:
a Java BigInteger value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

toBigDecimal

public static java.math.BigDecimal toBigDecimal(byte[] num)
                                         throws java.sql.SQLException
Converts an Oracle Number into a Java BigDecimal.

Parameters:
num - Oracle Number in byte array format
Returns:
a Java BigDecimal value
Throws:
java.sql.SQLException - on over/underflow of the Oracle Number exponent and on overflow of the mantissa.

toString

public static java.lang.String toString(byte[] num)
Convert an Oracle Number to a Java String. Negative numbers are represented by a leading "-". No sign is added for positive numbers. The output will always be in fixed decimal format.

Parameters:
num - Oracle Number in byte array format
Returns:
fixed point decimal string

toBoolean

public static boolean toBoolean(byte[] num)
Convert an Oracle Number to a Java boolean. A zero value translates to false and non-zero values translate to true,

Parameters:
num - Oracle Number in byte array format
Returns:
a Java boolean value

toBytes

public static byte[] toBytes(double doubleNum)
                      throws java.sql.SQLException
Converts a Java double to an Oracle Number byte array.

Parameters:
doubleNum - Java double value
Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.
Throws:
java.sql.SQLException - on over/underflow of the Oracle Number exponent and on overflow of the mantissa.

toBytes

public static byte[] toBytes(float floatNum)
Converts a Java float to an Oracle Number byte array.

Parameters:
floatNum - Java float value
Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.

toBytes

public static byte[] toBytes(long longNum)
Converts a Java long to an Oracle Number byte array.

Parameters:
longNum - Java long value
Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.

toBytes

public static byte[] toBytes(int intNum)
Converts a Java int to an Oracle Number byte array.

Parameters:
intNum - Java int value
Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.

toBytes

public static byte[] toBytes(short shortNum)
Converts a Java short to an Oracle Number byte array.

Parameters:
shortNum - Java short value
Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.

toBytes

public static byte[] toBytes(byte byteNum)
Converts a Java byte to an Oracle Number byte array.

Parameters:
byteNum - Java byte value
Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.

toBytes

public static byte[] toBytes(java.math.BigInteger BigIntNum)
                      throws java.sql.SQLException
Converts a Java BigInteger to an Oracle Number byte array. Rounding will occur on loss of precision. Positive and Negative Infinity are not considered.

Parameters:
BigIntNum - Java BigInteger value
Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.
Throws:
java.sql.SQLException - will be thrown if the Oracle Number exponent or mantissa overflows.

toBytes

public static byte[] toBytes(java.math.BigDecimal BigDecNum)
                      throws java.sql.SQLException
Converts a Java BigDecimal to an Oracle Number byte array.

Parameters:
BigDecNum - Java BigDecimal value
Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.
Throws:
java.sql.SQLException - on overflow/underflow of the Oracle Number exponent or mantissa.

toBytes

public static byte[] toBytes(java.lang.String StringNum,
                             int scale)
                      throws java.sql.SQLException
Converts a Java String to an Oracle Number byte array. Converts a fixed point number string. Negative numbers will begin with a - sign and numbers less than zero will begin with "0.".

Notes:

Parameters:
StringNum - Java String value
scale - scale to use
Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.
Throws:
java.sql.SQLException - on over/underflow of the Oracle Number exponent

toBytes

public static byte[] toBytes(boolean boolNum)
Converts a Java boolean to an Oracle Number byte array. A true value translates to 1 and a false value translates to 0.

Parameters:
boolNum - Java boolean value
Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.

toBytes

public byte[] toBytes()
Returns the internal Oracle Number byte array.

Returns:
a Java byte array in Oracle Number length separate format. The length instance variable holds Oracle Number length in bytes.

doubleValue

public double doubleValue()
Calls toDouble to convert internal Oracle Number to a Java double.

Overrides:
doubleValue in class Datum
Returns:
a Java double value

floatValue

public float floatValue()
Calls toFloat to convert internal Oracle Number to a Java float.

Overrides:
floatValue in class Datum
Returns:
a Java float value

longValue

public long longValue()
               throws java.sql.SQLException
Calls toLong to convert internal Oracle Number to a Java long.

Overrides:
longValue in class Datum
Returns:
a Java long value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

intValue

public int intValue()
             throws java.sql.SQLException
Calls toInt to convert internal Oracle Number to a Java int.

Overrides:
intValue in class Datum
Returns:
a Java int value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

shortValue

public short shortValue()
                 throws java.sql.SQLException
Calls toShort to convert internal Oracle Number to a Java short.

Returns:
a Java short value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

byteValue

public byte byteValue()
               throws java.sql.SQLException
Calls toByte to convert internal Oracle Number to a Java byte.

Overrides:
byteValue in class Datum
Returns:
a Java byte value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

bigIntegerValue

public java.math.BigInteger bigIntegerValue()
                                     throws java.sql.SQLException
Calls toBigInteger to convert internal Oracle Number to a Java BigInteger.

Returns:
a Java BigInteger value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

bigDecimalValue

public java.math.BigDecimal bigDecimalValue()
                                     throws java.sql.SQLException
Calls toBigDecimalto convert internal Oracle Number into a Java BigDecimal.

Overrides:
bigDecimalValue in class Datum
Returns:
a Java BigDecimal value
Throws:
java.sql.SQLException - on over/underflow of the Oracle Number exponent and on overflow of the mantissa.

stringValue

public java.lang.String stringValue()
Calls toString to convert internal Oracle Number to a Java String.

Overrides:
stringValue in class Datum
Returns:
a Java String value

booleanValue

public boolean booleanValue()
Calls toBoolean to convert internal Oracle Number to a Java boolean.

Overrides:
booleanValue in class Datum
Returns:
a Java boolean value

toJdbc

public java.lang.Object toJdbc()
                        throws java.sql.SQLException
Returns the JDBC representation of the datum object

Specified by:
toJdbc in class Datum
Returns:
an object containing the JDBC value
Throws:
java.sql.SQLException - if conversion to JDBC representation results in an error

makeJdbcArray

public java.lang.Object makeJdbcArray(int arraySize)
Returns a JDBC array representation of the datum

Specified by:
makeJdbcArray in class Datum
Parameters:
arraySize - size of the array
Returns:
an object containing the JDBC array value
Throws:
java.sql.SQLException - if conversion to JDBC array representation results in an error

isConvertibleTo

public boolean isConvertibleTo(java.lang.Class cls)
Determines if the object can be converted to a particular class

Specified by:
isConvertibleTo in class Datum
Parameters:
cls - Class to convert to
Returns:
true, if conversion to cls is permitted false, if conversion to cls is not permitted

abs

public NUMBER abs()
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the absolute value of NUMBER.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

acos

public NUMBER acos()
            throws java.sql.SQLException
Returns a new NUMBER object initialized to the arc cosine value of NUMBER.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

add

public NUMBER add(NUMBER n)
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the value of the addition of the NUMBER value and n.

Parameters:
n - input Oracle Number
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

asin

public NUMBER asin()
            throws java.sql.SQLException
Returns a new NUMBER object initialized to the arc sine value of NUMBER.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

atan

public NUMBER atan()
            throws java.sql.SQLException
Returns a new NUMBER object initialized to the arc tangent value of NUMBER.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

atan2

public NUMBER atan2(NUMBER x)
             throws java.sql.SQLException
Returns a new NUMBER object initialized to the value of atan2(NUMBER/x).

Parameters:
x - input Oracle Number
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

ceil

public NUMBER ceil()
            throws java.sql.SQLException
Returns a new NUMBER object initialized to the ceiling of NUMBER value.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

cos

public NUMBER cos()
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the cosine value of NUMBER.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

cosh

public NUMBER cosh()
            throws java.sql.SQLException
Returns a new NUMBER object initialized to the hyperbolic cosine value of NUMBER.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

decrement

public NUMBER decrement()
                 throws java.sql.SQLException
Returns a new NUMBER object initialized to the NUMBER value decremented by 1. Assumption: the NUMBER value represents a positive integer

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

div

public NUMBER div(NUMBER n)
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the division of NUMBER value by n.

Parameters:
n - input Oracle Number
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

exp

public NUMBER exp()
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the value of e raised to NUMBER value.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

floatingPointRound

public NUMBER floatingPointRound(int precision)
                          throws java.sql.SQLException
Returns a new NUMBER object initialized to Number rounded to precision significant decimal digits.

Parameters:
precision - input precision
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

floor

public NUMBER floor()
             throws java.sql.SQLException
Returns a new NUMBER object initialized to the floor of NUMBER value.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

increment

public NUMBER increment()
                 throws java.sql.SQLException
Returns a new NUMBER object initialized to the NUMBER value incremented by 1. Assumption: the NUMBER value represents a positive integer

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

ln

public NUMBER ln()
          throws java.sql.SQLException
Returns a new NUMBER object initialized to the natural logarithm of the NUMBER value.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

log

public NUMBER log(NUMBER base)
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the logarithm to the base base of the NUMBER value.

Parameters:
base - Base for calculating logarithm
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

mod

public NUMBER mod(NUMBER n)
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the remainder of the division of NUMBER/n.

Parameters:
n - input Oracle Number
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

mul

public NUMBER mul(NUMBER n)
           throws java.sql.SQLException
Returns a new NUMBER object initialized to product of NUMBER and n.

Parameters:
n - input Oracle Number
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

negate

public NUMBER negate()
              throws java.sql.SQLException
Returns a new NUMBER object initialized to the negated NUMBER value.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

pow

public NUMBER pow(NUMBER exp)
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the value of NUMBER value raised to the exp power.

Parameters:
exp - input Oracle Number exponent
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

pow

public NUMBER pow(int exp)
           throws java.sql.SQLException
Returns a new NUMBER object initialized to NUMBER value raised to the exp power. exp is an integer value.

Parameters:
exp - input integral exponent
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

round

public NUMBER round(int decimal_place)
             throws java.sql.SQLException
Returns a new NUMBER object initialized to the NUMBER value rounded to specified decimal place decimal_place.

Parameters:
decimal_place - decimal place to round to
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

scale

public NUMBER scale(int left,
                    int right,
                    boolean[] big)
             throws java.sql.SQLException
Returns a new NUMBER object initialized to the value determined by the rounding performed based on the right parameter below.

Parameters:
left - maximum number of decimal digits to the left of the decimal point. It will not effect the number but big will return true if this value is exceeded.
right - maximum number of decimal digits to the right of the decimal point. The number is rounded at this point. Negative values are allowed.
big - set to true if the number of left-hand-side digits is exceeded and false otherwise. If big is null, it is left unset.
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

shift

public NUMBER shift(int digits)
             throws java.sql.SQLException
Returns a new NUMBER object initialized the NUMBER value shifted digits decimal places.

Parameters:
digits - number of decimal places to shift. Can be negative. Positive values shift the decimal place to the right and negative values to the left. For example, if NUMBER corresponds to 1234.5 and digits == -1, the new NUMBER object will correspond to 123.45.
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

sin

public NUMBER sin()
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the sine of the NUMBER.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

sinh

public NUMBER sinh()
            throws java.sql.SQLException
Returns a new NUMBER object initialized to the hyperbolic sine of NUMBER.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

sqroot

public NUMBER sqroot()
              throws java.sql.SQLException
Returns a new NUMBER object initialized to the square root of NUMBER.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

sub

public NUMBER sub(NUMBER n)
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the difference of NUMBER and n.

Parameters:
n - input Oracle Number
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

tan

public NUMBER tan()
           throws java.sql.SQLException
Returns a new NUMBER object initialized to the tangent of NUMBER.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

tanh

public NUMBER tanh()
            throws java.sql.SQLException
Returns a new NUMBER object initialized to the hyperbolic tangent of Number.

Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

truncate

public NUMBER truncate(int decimal_place)
                throws java.sql.SQLException
Returns a new NUMBER object initialized to the NUMBER value truncated to specified decimal place decimal_place.

Parameters:
decimal_place - decimal place to truncate to
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

formattedTextToNumber

public static NUMBER formattedTextToNumber(java.lang.String num,
                                           java.lang.String fmt,
                                           java.lang.String lang)
                                    throws java.sql.SQLException
Returns a NUMBER converted from Num controlled by the format fmt.

Parameters:
num - input string representing a numeric value
fmt - format string [see "Oracle 8 Server Concepts Manual" or "CORE User's Guide Appendix D"]
lang - the NLS language the conversion is to be performed in, null indicates use default.
Returns:
a new NUMBER Object
Throws:
java.sql.SQLException - if Java implementation is not available

textToPrecisionNumber

public static NUMBER textToPrecisionNumber(java.lang.String num,
                                           boolean precflag,
                                           int preclen,
                                           boolean scaleflag,
                                           int scalelen,
                                           java.lang.String lang)
                                    throws java.sql.SQLException
Returns a NUMBER object initialized to the value in num as described below.

Parameters:
num - input string representing a numeric value
precflag - if true, then a precision restriction should be applied
preclen - the maximum number of the decimal digits the NUMBER may have, subject to the scale requirement. The number is NOT rounded if more than preclen decimal digits must be placed in the number to meet the scale requirement. ncp is set to 0 if the precision restriction is violated. preclen is ignored if precflag is false.
scaleflag - if true then scale restriction should be applied
scalelen - the maximum number of decimal digits to the right of the decimal point in the NUMBER Negative values are allowed. Any excess digits are rounded off, this is not reported. If enough digits are available in the input, the maximum digits will be written to the right of the decimal place even if the percussion restriction is violated. scalelen is ignored if scaleflag is false. if precision is specified but scale is not, the scale is assumed to be 0.
lang - the NLS language the conversion is to be performed in, null indicates use default.
Returns:
a new NUMBER object
Throws:
java.sql.SQLException - if Java implementation is not available

toFormattedText

public java.lang.String toFormattedText(java.lang.String fmt,
                                        java.lang.String lang)
                                 throws java.sql.SQLException
Returns a new String based on the format specified in fmt and NUMBER.

For pure Java implementation only Notes:

Parameters:
fmt - format string [see "Oracle 8 Server Concepts Manual" or "CORE User's Guide Appendix D"]
lang - the NLS language the conversion is to be performed in, null indicates use default.
Returns:
a new String
Throws:
java.sql.SQLException

toText

public java.lang.String toText(int outStringLength,
                               java.lang.String lang)
                        throws java.sql.SQLException
Returns a String with the unformatted representation of NUMBER.

Parameters:
outStringLength - |outStringLength| is the length of the result string. If outStringLength < 0, the result string is in scientific notation.
lang - the NLS language the conversion is to be performed in, null indicates use default.
Returns:
a new String
Throws:
java.sql.SQLException - if Java implementation is not available

compareTo

public int compareTo(NUMBER n)
Returns -1 if NUMBER is less than n, 0 if NUMBER and n are equal (==), 1 if NUMBER is greater than n.

Parameters:
n - input Oracle Number
Returns:
integer result of comparison

isInf

public boolean isInf()
Returns true if NUMBER value is positive or negative infinity and a false otherwise.

Returns:
boolean

isNegInf

public boolean isNegInf()
Returns returns true if NUMBER is negative infinity and false otherwise.

Returns:
boolean

isPosInf

public boolean isPosInf()
Returns true if NUMBER is positive infinity and false otherwise.

Returns:
boolean

isInt

public boolean isInt()
Returns true if NUMBER value is finite and integral.

Returns:
boolean

isValid

public static boolean isValid(byte[] num)
Checks if a given Oracle Number is valid

Parameters:
num - input Oracle Number
Returns:
boolean

isZero

public boolean isZero()
Returns true if NUMBER is zero.

Returns:
boolean

e

public static NUMBER e()
Returns a new NUMBER object initialized to the value of e.

Returns:
a new NUMBER object

ln10

public static NUMBER ln10()
Returns a new NUMBER object initialized to the value of ln(10).

Returns:
a new NUMBER object

negInf

public static NUMBER negInf()
Returns a new NUMBER object initialized to negative infinity.

Returns:
a new NUMBER object

pi

public static NUMBER pi()
Returns a new NUMBER object initialized to the value of pi.

Returns:
a new NUMBER object

posInf

public static NUMBER posInf()
Returns a new NUMBER object initialized to positive infinity.

Returns:
a new NUMBER object

zero

public static NUMBER zero()
Returns a new NUMBER object initialized to zero.

Returns:
a new NUMBER object

sign

public int sign()
Returns -1 if the sign of NUMBER is negative, 0 if NUMBER is 0, and > 0 if NUMBER is positive.

Returns:
int representing the sign

Oracle JDBC API Reference
11g Release 2 ("11.2.0.3.0")

Copyright © 1998, 2007, Oracle. All rights reserved.