This section describes the OCI NUMBER functions.
See Also:
"OCINumber Examples"| Function/Page | Purpose | 
|---|---|
| Computes the absolute value | |
| Adds  | |
| Computes the arc cosine | |
| Computes the arc sine | |
| Computes the arc tangent | |
| Computes the arc tangent of two  | |
| Assigns one  | |
| Computes the ceiling of  | |
| Compares  | |
| Computes the cosine | |
| Decrements a  | |
| Divides two  | |
| Raises e to the specified Oracle  | |
| Computes the floor of a  | |
| Converts an integer to an Oracle  | |
| Convert a real to an Oracle  | |
| Convert a string to an Oracle  | |
| Computes the hyperbolic cosine | |
| Computes the hyperbolic sine | |
| Computes the hyperbolic tangent | |
| Increments an Oracle  | |
| Raises a given base to an integer power | |
| Tests if a  | |
| Tests if a  | |
| Computes the natural logarithm | |
| Computes the logarithm to an arbitrary base | |
| Modulo division | |
| Multiplies  | |
| Negates a  | |
| Exponentiation to base e | |
| Rounds a  | |
| Rounds an Oracle  | |
| Initializes a  | |
| Initializes a  | |
| Multiplies by 10, shifting specified number of decimal places | |
| Obtains the sign of an Oracle  | |
| Computes the sine | |
| Computes the square root of a  | |
| Subtracts  | |
| Computes the tangent | |
| Converts an Oracle  | |
| Converts an Oracle  | |
| Converts an array of  | |
| Converts an Oracle  | |
| Truncates an Oracle  | 
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Input NUMBER.
The absolute value of the input NUMBER.
sword OCINumberAdd ( OCIError              *err,
                     const OCINumber       *number1, 
                     const OCINumber       *number2,
                     OCINumber             *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBERs to be added.
Result of adding number1 to number2.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Argument of the arc cosine.
Result of the arc cosine in radians.
This function returns an error if any of the NUMBER arguments is NULL, or if number is less than -1 or if number is greater than 1.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Argument of the arc sine.
Result of the arc sine in radians.
This function returns an error if any of the NUMBER arguments is NULL, or if number is less than -1 or if number is greater than 1.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Argument of the arc tangent.
Result of the arc tangent in radians.
sword OCINumberArcTan2 ( OCIError              *err, 
                         const OCINumber       *number1, 
                         const OCINumber       *number2,
                         OCINumber             *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Argument 1 of the arc tangent.
Argument 2 of the arc tangent.
Result of the arc tangent in radians.
This function returns an error if any of the NUMBER arguments is NULL, or if number2 is equal to 0.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBER to be assigned.
NUMBER copied into.
Assigns the NUMBER identified by from to the NUMBER identified by to.
This function returns an error if any of the NUMBER arguments is NULL.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Input NUMBER.
Output which will contain the ceiling value of the input NUMBER.
sword OCINumberCmp ( OCIError            *err,
                     const OCINumber     *number1, 
                     const OCINumber     *number2,
                     sword               *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBERs to compare.
Comparison result:
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Argument of the cosine in radians.
Result of the cosine.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
A positive Oracle NUMBER to be decremented.
Decrements an Oracle NUMBER in place. It is assumed that the input is an integer between 0 and 100^21-2. If the is input too large, it will be treated as 0 - the result will be an Oracle NUMBER 1. If the input is not a positive integer, the result will be unpredictable.
This function returns an error if the input NUMBER is NULL.
sword OCINumberDiv ( OCIError               *err,
                     const OCINumber        *number1, 
                     const OCINumber        *number2,
                     OCINumber              *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Pointer to the numerator.
Pointer to the denominator.
Division result.
Divides number1 by number2 and returns result in result.
This function returns an error if:
any of the NUMBER arguments is NULL
there is an underflow error
there is a divide-by-zero error
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
This function raises e to this Oracle NUMBER power.
Output of exponentiation.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Input NUMBER.
The floor value of the input NUMBER.
sword OCINumberFromInt ( OCIError            *err,
                         const void          *inum, 
                         uword               inum_length,
                         uword               inum_s_flag,
                         OCINumber           *number );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Pointer to the integer to convert.
Size of the integer.
Flag that designates the sign of the integer, as follows:
OCI_NUMBER_UNSIGNED - Unsigned values
OCI_NUMBER_SIGNED - Signed values
Given integer converted to Oracle NUMBER.
This is a native type conversion function. It converts any Oracle standard system-native integer type, such as ub4 or sb2, to an Oracle NUMBER.
This function returns an error if the number is too big to fit into an Oracle NUMBER, if number or inum is NULL, or if an invalid sign flag value is passed in inum_s_flag.
sword OCINumberFromReal ( OCIError           *err,
                          const void         *rnum,
                          uword              rnum_length,
                          OCINumber          *number );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Pointer to the floating point number to convert.
The size of the desired result, which equals sizeof({float | double | long double}).
Given float converted to Oracle NUMBER.
This is a native type conversion function. It converts a system-native floating point type to an Oracle NUMBER.
This function returns an error if number or rnum is NULL, or if rnum_length equals zero.
sword OCINumberFromText ( OCIError           *err, 
                          const OraText      *str, 
                          ub4                str_length,
                          const OraText      *fmt,
                          ub4                fmt_length, 
                          const OraText      *nls_params, 
                          ub4                nls_p_length, 
                          OCINumber          *number );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Input string to convert to Oracle NUMBER.
Size of the input string.
Conversion format.
Length of the fmt parameter.
Global Support format specification. If it is the NULL string (""), then the default parameters for the session is used.
Length of the nls_params parameter.
Given string converted to NUMBER.
Converts the given string to a NUMBER according to the specified format. Refer to the TO_NUMBER conversion function described in the Oracle Database SQL Language Reference for a description of format and multilingual parameters.
This function returns an error if there is an invalid format, an invalid multibyte format, or an invalid input string, if number or str is NULL, or if str_length is zero.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Argument of the cosine hyperbolic.
Result of the cosine hyperbolic.
This function returns an error if either of the NUMBER arguments is NULL.
Caution:
An OracleNUMBER overflow causes an unpredictable result value.The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Argument of the sine hyperbolic.
Result of the sine hyperbolic.
This function returns an error if either of the NUMBER arguments is NULL.
Caution:
An OracleNUMBER overflow causes an unpredictable result value.The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Argument of the tangent hyperbolic.
Result of the tangent hyperbolic.
This function returns an error if either of the NUMBER arguments is NULL.
Caution:
An OracleNUMBER overflow causes an unpredictable result value.The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
A positive Oracle NUMBER to be incremented.
Increments an Oracle NUMBER in place. It is assumed that the input is an integer between 0 and 100^21-2. If the is input too large, it will be treated as 0 - the result will be an Oracle NUMBER 1. If the input is not a positive integer, the result will be unpredictable.
This function returns an error if the input NUMBER is NULL.
sword OCINumberIntPower ( OCIError             *err, 
                          const OCINumber      *base, 
                          const sword          exp,
                          OCINumber            *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Base of the exponentiation.
Exponent to which the base is raised.
Output of exponentiation.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBER to be tested
Set to TRUE if integer value else FALSE
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBER to compare.
Set to TRUE if equal to zero; otherwise, set to FALSE.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Logarithm of this NUMBER is computed.
Logarithm result.
This function returns an error if either of the NUMBER arguments is NULL, or if number is less than or equal to zero.
sword OCINumberLog ( OCIError              *err, 
                     const OCINumber       *base, 
                     const OCINumber       *number, 
                     OCINumber             *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Base of the logarithm.
Operand.
Logarithm result.
This function returns an error if:
any of the NUMBER arguments is NULL
number <= 0
base <= 0
sword OCINumberMod ( OCIError              *err,
                     const OCINumber       *number1, 
                     const OCINumber       *number2,
                     OCINumber             *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Pointer to the numerator.
Pointer to the denominator.
Remainder of the result.
This function returns an error if number1 or number2 is NULL, or if there is a divide-by-zero error.
sword OCINumberMul ( OCIError              *err,
                     const OCINumber       *number1, 
                     const OCINumber       *number2,
                     OCINumber             *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBER to multiply.
NUMBER to multiply.
Multiplication result.
Multiplies number1 with number2 and returns result in result.
This function returns an error if any of the NUMBER arguments is NULL.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBER to negate.
Contains negated value of number.
sword OCINumberPower ( OCIError              *err,
                       const OCINumber       *base, 
                       const OCINumber       *number, 
                       OCINumber             *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Base of the exponentiation.
Exponent to which the base is to be raised.
Output of exponentiation.
sword OCINumberPrec ( OCIError *err, 
                      const OCINumber *number,
                      eword nDigs, 
                      OCINumber *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
The number for which to set precision.
The number of decimal digits desired in the result.
The result.
Performs a floating point round with respect to the number of digits.
This function returns an error any of the NUMBER arguments is NULL.
sword OCINumberRound ( OCIError              *err,
                       const OCINumber       *number,
                       sword                 decplace,
                       OCINumber             *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBER to round.
Number of decimal digits to the right of the decimal point to round to. Negative values are allowed.
Output of rounding.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBER set to the value of Pi.
A valid OCI error handle. This function does not check for errors because the function will never produce an error.
NUMBER to initialize to zero value.
sword OCINumberShift ( OCIError         *err, 
                       const OCINumber  *number,
                       const sword      nDig,
                       OCINumber        *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Oracle NUMBER to be shifted.
Number of decimal places to shift.
Shift result.
Multiplies number by 10^nDig and sets product to the result.
This function returns an error if the input number is NULL.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBER whose sign is returned.
Possible values:
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Argument of the sine in radians.
Result of the sine.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Input NUMBER.
Output which will contain the square root of the input NUMBER.
sword OCINumberSub ( OCIError             *err,
                     const OCINumber      *number1, 
                     const OCINumber      *number2, 
                     OCINumber            *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
This function subtracts number2 from number1.
Subtraction result.
Subtracts number2 from number1 and returns result in result.
This function returns an error if any of the NUMBER arguments is NULL.
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Argument of the tangent in radians.
Result of the tangent.
sword OCINumberToInt ( OCIError              *err,
                       const OCINumber       *number,
                       uword                 rsl_length,
                       uword                 rsl_flag, 
                       void                  *rsl );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBER to convert.
Size of the desired result.
Flag that designates the sign of the output, as follows:
OCI_NUMBER_UNSIGNED - Unsigned values
OCI_NUMBER_SIGNED - Signed values
Pointer to space for the result.
This is a native type conversion function. It converts the given Oracle NUMBER into an integer of the form xbn, such as ub2, ub4, or sb2.
This function returns an error if number or rsl is NULL, if number is too big (overflow) or too small (underflow), or if an invalid sign flag value is passed in rsl_flag.
sword OCINumberToReal ( OCIError            *err,
                        const OCINumber     *number,
                        uword               rsl_length,
                        void                *rsl );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
NUMBER to convert.
The size of the desired result, which equals sizeof({ float | double | long double}).
Pointer to space for storing the result.
This is a native type conversion function. It converts an Oracle NUMBER into a system-native real type. This function only converts NUMBERs up to LDBL_DIG, DBL_DIG, or FLT_DIG digits of precision and removes trailing zeroes. These constants are defined in float.h.
You must pass a valid OCINumber to this function. Otherwise, the result is undefined.
sword OCINumberToRealArray ( OCIError         *err, 
                             const OCINumber  **number,
                             uword            elems, 
                             uword            rsl_length, 
                             void             *rsl );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Pointer to array of NUMBER to be converted.
Maximum number of NUMBER pointers.
The size of the desired result, that is, sizeof({ float | double | long double }).
Pointer to array of space for storing the result.
Native type conversion function that converts an Oracle NUMBER into a system-native real type. This function only converts numbers up to LDBL_DIG, DBL_DIG, or FLT_DIG digits of precision and removes trailing zeroes. The constants are defined in the float.h header file.
You must pass a valid OCINumber to this function. Otherwise, the result is undefined.
OCI_SUCCESS - the function completes successfully.
OCI_INVALID_HANDLE - if err is NULL.
OCI_ERROR - if number or rsl is NULL, or rsl_length is 0.
sword OCINumberToText ( OCIError             *err,
                        const OCINumber      *number, 
                        const OraText        *fmt, 
                        ub4                  fmt_length,
                        const OraText        *nls_params, 
                        ub4                  nls_p_length,
                        ub4                  *buf_size, 
                        OraText              *buf );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Oracle NUMBER to convert.
Conversion format.
Length of the fmt parameter.
Global Support format specification. If it is a NULL string ((text *)0 ), then the default parameters for the session is used.
Length of the nls_params parameter.
Size of the buffer.
Buffer into which the converted string is placed.
Refer to the TO_NUMBER conversion function described in the Oracle Database SQL Language Reference for a description of format and Global Support parameters.
The converted number string is stored in buf, up to a maximum of buf_size bytes. This function returns an error if:
number or buf is NULL
buffer is too small
invalid format or invalid multibyte format is passed
number to text translation for given format causes an overflow
sword OCINumberTrunc ( OCIError             *err,
                       const OCINumber      *number, 
                       sword                decplace,
                       OCINumber            *result );
The OCI error handle. If there is an error, it is recorded in err and this function returns OCI_ERROR. Obtain diagnostic information by calling OCIErrorGet().
Input NUMBER.
Number of decimal digits to the right of the decimal point at which to truncate. Negative values are allowed.
Output of truncation.