Oracle® Call Interface Programmer's Guide 11g Release 2 (11.2) Part Number E10646-10 |
|
|
PDF · Mobi · ePub |
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 |
Computes the absolute value of an Oracle NUMBER
.
sword OCINumberAbs ( OCIError *err, 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().
Input NUMBER
.
The absolute value of the input NUMBER
.
This function returns an error if any of the NUMBER
arguments is NULL
.
Adds two Oracle NUMBER
s together.
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
.
This function returns an error if any of the NUMBER
arguments is NULL
.
Takes the arc cosine in radians of an Oracle NUMBER
.
sword OCINumberArcCos ( OCIError *err, 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().
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.
Takes the arc sine in radians of an Oracle NUMBER
.
sword OCINumberArcSin ( OCIError *err, 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().
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.
Takes the arc tangent in radians of an Oracle NUMBER
.
sword OCINumberArcTan ( OCIError *err, 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().
Argument of the arc tangent.
Result of the arc tangent in radians.
This function returns an error if any of the NUMBER
arguments is NULL
.
Takes the arc tangent of two Oracle NUMBER
s.
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.
Assigns one Oracle NUMBER
to another Oracle NUMBER
.
sword OCINumberAssign ( OCIError *err, const OCINumber *from, OCINumber *to );
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
.
Computes the ceiling value of an Oracle NUMBER
.
sword OCINumberCeil ( OCIError *err, 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().
Input NUMBER
.
Output that contains the ceiling value of the input NUMBER
.
This function returns an error if any of the NUMBER
arguments is NULL
.
OCIErrorGet(), OCINumberFloor()
Compares two Oracle NUMBER
s.
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.
Table 19-12 Comparison Results Returned by the result Parameter for OCINumberCmp()
Comparison Result | Output in result Parameter |
---|---|
|
negative |
|
|
|
positive |
This function returns an error if any of the NUMBER
arguments is NULL
.
OCIErrorGet(), OCINumberAssign()
Computes the cosine in radians of an Oracle NUMBER
.
sword OCINumberCos ( OCIError *err, 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().
Argument of the cosine in radians.
Result of the cosine.
This function returns an error if any of the NUMBER
arguments is NULL
.
OCIErrorGet(), OCINumberArcCos()
Decrements an Oracle NUMBER
in place.
sword OCINumberDec ( OCIError *err, 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().
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.
This function returns an error if the input NUMBER
is NULL
.
Divides two Oracle NUMBER
s.
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 the result in 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.
Raises e to the specified Oracle NUMBER
power.
sword OCINumberExp ( OCIError *err, 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().
This function raises e to this Oracle NUMBER
power.
Output of exponentiation.
This function returns an error if any of the NUMBER
arguments is NULL
.
Computes the floor (round down) value of an Oracle NUMBER
.
sword OCINumberFloor ( OCIError *err, 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().
Input NUMBER
.
The floor (round down) value of the input NUMBER
.
This function returns an error if any of the NUMBER
arguments is NULL
.
OCIErrorGet(), OCINumberCeil()
Converts an integer to an Oracle 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
.
OCIErrorGet(), OCINumberToInt()
Converts a real (floating-point) type to an Oracle NUMBER
.
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.
OCIErrorGet(), OCINumberToReal()
Converts a character string 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.
OCIErrorGet(), OCINumberToText()
Computes the hyperbolic cosine of an Oracle NUMBER
.
sword OCINumberHypCos ( OCIError *err, 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().
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.OCIErrorGet(), OCINumberHypSin(), OCINumberHypTan()
Computes the hyperbolic sine of an Oracle NUMBER
.
sword OCINumberHypSin ( OCIError *err, 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().
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.OCIErrorGet(), OCINumberHypCos(), OCINumberHypTan()
Computes the hyperbolic tangent of an Oracle NUMBER
.
sword OCINumberHypTan ( OCIError *err, 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().
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.OCIErrorGet(), OCINumberHypCos(), OCINumberHypSin()
Increments an Oracle NUMBER
.
sword OCINumberInc ( OCIError *err, 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().
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.
This function returns an error if the input NUMBER
is NULL
.
Raises a given base to a given integer power.
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.
This function returns an error if either of the NUMBER
arguments is NULL
.
OCIErrorGet(), OCINumberPower()
Tests if an OCINumber is an integer.
sword OCINumberIsInt ( OCIError *err, const OCINumber *number, boolean *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 be tested.
Set to TRUE
if integer value; otherwise, FALSE
This function returns an error if number
or result
is NULL
.
OCIErrorGet(), OCINumberRound(), OCINumberTrunc()
Tests if the given NUMBER
equals zero.
sword OCINumberIsZero ( OCIError *err, const OCINumber *number, boolean *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 compare.
Set to TRUE
if equal to zero; otherwise, set to FALSE
.
This function returns an error if the NUMBER
argument is NULL
.
OCIErrorGet(), OCINumberSetZero()
Takes the natural logarithm (base e) of an Oracle NUMBER
.
sword OCINumberLn ( OCIError *err, 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().
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.
OCIErrorGet(), OCINumberExp(), OCINumberLog()
Takes the logarithm, to any base, of an Oracle NUMBER
.
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
Gets the modulus (remainder) of the division of two Oracle NUMBER
s.
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.
Multiplies two Oracle NUMBER
s.
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 the result in result
.
This function returns an error if any of the NUMBER
arguments is NULL
.
Negates an Oracle NUMBER
.
sword OCINumberNeg ( OCIError *err, 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().
NUMBER
to negate.
Contains negated value of number
.
This function returns an error if either of the NUMBER
arguments is NULL
.
OCIErrorGet(), OCINumberAbs(), OCINumberSign()
Raises a given base to a given exponent.
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.
This function returns an error if any of the NUMBER
arguments is NULL
.
Rounds an OCINumber
to a specified number of decimal digits.
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
.
OCIErrorGet(), OCINumberRound()
Rounds an Oracle NUMBER
to a specified decimal place.
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.
This function returns an error if any of the NUMBER
arguments is NULL
.
OCIErrorGet(), OCINumberTrunc()
Sets an OCINumber
to pi.
void OCINumberSetPi ( OCIError *err, OCINumber *num );
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.
Initializes the given NUMBER
to the value of pi.
Initializes an Oracle NUMBER
to zero.
void OCINumberSetZero ( OCIError *err OCINumber *num );
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.
None.
Multiplies a NUMBER
by a power of 10 by shifting it a specified number of decimal places.
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
.
Gets sign of an Oracle NUMBER
.
sword OCINumberSign ( OCIError *err, const OCINumber *number, 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().
Oracle NUMBER
whose sign is returned.
Table 19-13 lists the possible return values.
Value of number | Output in result Parameter |
---|---|
|
-1 |
|
0 |
|
1 |
This function returns an error if number
or result
is NULL
.
Computes the sine in radians of an Oracle NUMBER
.
sword OCINumberSin ( OCIError *err, 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().
Argument of the sine in radians.
Result of the sine.
This function returns an error if either of the number
arguments is NULL
.
OCIErrorGet(), OCINumberArcSin()
Computes the square root of an Oracle NUMBER
.
sword OCINumberSqrt ( OCIError *err, 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().
Input NUMBER
.
Output that contains the square root of the input NUMBER
.
This function returns an error if number
is NULL
or number
is negative.
OCIErrorGet(), OCINumberPower()
Subtracts two Oracle NUMBER
s.
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 the result in result
.
This function returns an error if any of the number
arguments is NULL
.
Computes the tangent in radians of an Oracle NUMBER
.
sword OCINumberTan ( OCIError *err, 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().
Argument of the tangent in radians.
Result of the tangent.
This function returns an error if any of the NUMBER
arguments is NULL
.
OCIErrorGet(), OCINumberArcTan(), OCINumberArcTan2()
Converts an Oracle NUMBER
type to integer.
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
.
OCIErrorGet(), OCINumberFromInt()
Converts an Oracle NUMBER
type to a real type.
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.
OCIErrorGet(), OCINumberFromReal()
Converts an array of NUMBER
to an array of real type.
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.
OCIErrorGet(), OCINumberToReal()
Converts an Oracle NUMBER
to a character string according to a specified format.
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
OCIErrorGet(), OCINumberFromText()
Truncates an Oracle NUMBER
at a specified decimal place.
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.
This function returns an error if any of the NUMBER
arguments is NULL
.