Table 19-11 describes the OCI NUMBER
functions that are described in this section.
See Also:
"OCINumber Examples"Function | Purpose |
---|---|
Compute the absolute value |
|
Add |
|
Compute the arc cosine |
|
Compute the arc sine |
|
Compute the arc tangent |
|
Compute the arc tangent of two |
|
Assign one |
|
Compute the ceiling of |
|
Compare |
|
Compute the cosine |
|
Decrement a |
|
Divide two |
|
Raise e to the specified Oracle |
|
Compute the floor value of a |
|
Convert an integer to an Oracle |
|
Convert a real type to an Oracle |
|
Convert a string to an Oracle |
|
Compute the hyperbolic cosine |
|
Compute the hyperbolic sine |
|
Compute the hyperbolic tangent |
|
Increment an Oracle |
|
Raise a given base to an integer power |
|
Test if a |
|
Test if a |
|
Compute the natural logarithm |
|
Compute the logarithm to an arbitrary base |
|
Gets the modulus (remainder) of the division of two Oracle |
|
Multiply two Oracle |
|
Negates an Oracle |
|
Raises a given base to a given exponent |
|
Round a |
|
Round an Oracle |
|
Initialize a |
|
Initialize a |
|
Multiply by 10, shifting a specified number of decimal places |
|
Obtain the sign of an Oracle |
|
Compute the sine |
|
Compute the square root of a |
|
Subtract |
|
Compute the tangent |
|
Convert an Oracle |
|
Convert an Oracle |
|
Convert an array of |
|
Convert an Oracle |
|
Truncate 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().
NUMBER
s 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
, 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
, 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
equals 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.
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 that contains 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().
NUMBER
s to compare.
Comparison result as specified in Table 19-12.
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 input is too large, it is treated as 0; the result is an Oracle NUMBER
1. If the input is not a positive integer, the result is unpredictable.
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.
This function returns an error if any of the following statements is true:
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 (round down) 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
.
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.
Globalization support format specification. If it is the NULL
string (""), then the default parameters for the session are used.
Length of the nls_params
parameter.
Given string converted to NUMBER
.
Converts the given string to a NUMBER
according to the specified format. See 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 input is too large, it is treated as 0 - the result is an Oracle NUMBER
1. If the input is not a positive integer, the result is unpredictable.
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; otherwise, 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
The value of number
<= 0
The value of 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.
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.
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 never produces an error.
Oracle 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.
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
whose sign is returned.
Table 19-13 lists the possible return 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 that contains 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.
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().
Oracle 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().
Oracle 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 NUMBER
s up to LDBL_DIG, DBL_DIG, or FLT_DIG digits of precision and removes trailing zeros. 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_DI
G
, 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
, if the function completes successfully; OCI_INVALID_HANDLE
, if err
is NULL
; or 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.
Globalization 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.
See the TO_NUMBER
conversion function described in the Oracle Database SQL Language Reference for a description of format and globalization support parameters.
The converted number string is stored in buf
, up to a maximum of buf_size
bytes.
This function returns an error if:
The value of number
or buf
is NULL
The buffer is too small
An invalid format or invalid multibyte format is passed
A 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.