Oracle® Call Interface Programmer's Guide, 10g Release 2 (10.2) Part Number B14250-02 |
|
|
PDF · Mobi · ePub |
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 |
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 numbers 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()
.
Numbers 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
, or 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
, or 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 numbers.
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.
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 which will contain 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 numbers.
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:
Table 18-13 Comparison Results
Comparison result | Output in result parameter |
---|---|
number1 < number2 |
negative |
number1 = number2 |
0 |
number1 > number2 |
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 OCINumber.
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 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
.
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 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
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 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 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 dvoid *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 machine-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 dvoid *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 machine-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 character string to 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.
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 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 Oracle number overflow causes an unpredictable result value.OCIErrorGet(), OCINumberHypSin(), 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 OCINumber.
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 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
.
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 else FALSE
This function returns an error if number
or result
is NULL
.
OCIErrorGet(), OCINumberRound(), OCINumberTrunc()
Tests if the given NUMBER
is equal to 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
number
<= 0
base
<= 0
Gets the modulus (remainder) of the division of two Oracle NUMBERs
.
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 NUMBERs
.
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
.
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 will never produce an error.
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()
.
NUMBER
whose sign is returned.
Possible values:
Value of number | Output in result parameter |
---|---|
number < 0 |
-1 |
number == 0 |
0 |
number > 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 which will contain the square root of the input NUMBER
.
This function returns an error if number
is NULL
or number
is negative.
OCIErrorGet(), OCINumberPower()
Subtract 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 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, dvoid *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
.
OCIErrorGet(), OCINumberFromInt()
Converts an Oracle NUMBER
type to real.
sword OCINumberToReal ( OCIError *err, CONST OCINumber *number, uword rsl_length, dvoid *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 machine-native real type. This function only converts NUMBER
s 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.
OCIErrorGet(), OCINumberFromReal()
Converts an array of NUMBER
to an array of real.
sword OCINumberToRealArray ( OCIError *err, CONST OCINumber **number, uword elems, uword rsl_length, dvoid *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 machine-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.
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, text *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 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
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
.