OCI NUMBER Functions
Lists and describes the OCI NUMBER
functions.
Table 28-11 describes the OCI NUMBER
functions that are described in this section.
See Also:
Table 28-11 NUMBER Functions
Function | Purpose |
---|---|
Compute the absolute value |
|
Add a |
|
Compute the arc cosine |
|
Compute the arc sine |
|
Compute the arc tangent |
|
Compute the arc tangent given two arguments for |
|
Assign one |
|
Compute the ceiling of |
|
Compare one |
|
Compute the cosine |
|
Decrement a |
|
Divide a |
|
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 one 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 a |
|
Compute the tangent |
|
Convert an Oracle |
|
Convert an Oracle |
|
Convert an array of |
|
Convert an Oracle |
|
Truncate an Oracle |
OCINumberAbs()
Computes the absolute value of an Oracle NUMBER
.
Purpose
Computes the absolute value of an Oracle NUMBER
.
Syntax
sword OCINumberAbs ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberAdd()
Adds a NUMBER
to another NUMBER
.
Purpose
Adds a NUMBER
to another NUMBER
.
Syntax
sword OCINumberAdd ( OCIError *err, const OCINumber *number1, const OCINumber *number2, OCINumber *result );
Parameters
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberArcCos()
Takes the arc cosine in radians of an Oracle NUMBER
.
Purpose
Takes the arc cosine in radians of an Oracle NUMBER
.
Syntax
sword OCINumberArcCos ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
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.
Related Topics
OCINumberArcSin()
Takes the arc sine in radians of an Oracle NUMBER
.
Purpose
Takes the arc sine in radians of an Oracle NUMBER
.
Syntax
sword OCINumberArcSin ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
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.
Related Topics
OCINumberArcTan()
Takes the arc tangent in radians of an Oracle NUMBER
.
Purpose
Takes the arc tangent in radians of an Oracle NUMBER
.
Syntax
sword OCINumberArcTan ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberArcTan2()
Takes the arc tangent given two arguments for Oracle NUMBER
.
Purpose
Takes the arc tangent given two arguments for Oracle NUMBER
.
Syntax
sword OCINumberArcTan2 ( OCIError *err, const OCINumber *number1, const OCINumber *number2, OCINumber *result );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - number1 (IN)
-
Argument 1 of the arc tangent.
- number2 (IN)
-
Argument 2 of the arc tangent.
- result (OUT)
-
Result of the arc tangent in radians.
Returns
This function returns an error if any of the NUMBER
arguments is NULL
or if number2
equals 0.
Related Topics
OCINumberAssign()
Assigns one Oracle NUMBER
to another Oracle NUMBER
.
Purpose
Assigns one Oracle NUMBER
to another Oracle NUMBER
.
Syntax
sword OCINumberAssign ( OCIError *err, const OCINumber *from, OCINumber *to );
Parameters
Comments
Assigns the NUMBER
identified by from
to the NUMBER
identified by to
.
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberCeil()
Computes the ceiling value of an Oracle NUMBER
.
Purpose
Computes the ceiling value of an Oracle NUMBER
.
Syntax
sword OCINumberCeil ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberCmp()
Compares one Oracle NUMBER
with another Oracle NUMBER
.
Purpose
Compares one Oracle NUMBER
with another Oracle NUMBER
.
Syntax
sword OCINumberCmp ( OCIError *err, const OCINumber *number1, const OCINumber *number2, sword *result );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - number1, number2 (IN)
-
The first
NUMBER
to compare with the secondNUMBER
. - result (OUT)
-
Comparison result as specified in Table 28-12.
Table 28-12 Comparison Results Returned by the result Parameter for OCINumberCmp()
Comparison Result | Output in result Parameter |
---|---|
|
negative |
|
|
|
positive |
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberCos()
Computes the cosine in radians of an Oracle NUMBER
.
Purpose
Computes the cosine in radians of an Oracle NUMBER
.
Syntax
sword OCINumberCos ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberDec()
12.1.0.2, added a short description.
Purpose
Decrements an Oracle NUMBER
in place.
Syntax
sword OCINumberDec ( OCIError *err, OCINumber *number );
Parameters
Comments
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.
Returns
This function returns an error if the input NUMBER
is NULL
.
Related Topics
OCINumberDiv()
Divides one Oracle NUMBER
by another Oracle NUMBER
.
Purpose
Divides one Oracle NUMBER
by another Oracle NUMBER
.
Syntax
sword OCINumberDiv ( OCIError *err, const OCINumber *number1, const OCINumber *number2, OCINumber *result );
Parameters
Comments
Divides number1
by number2
and returns the result in result
.
Returns
This function returns an error if any of the following statements is true:
-
Any of the
NUMBER
arguments isNULL
. -
There is an underflow error.
-
There is a divide-by-zero error.
Related Topics
OCINumberExp()
Raises e to the specified Oracle NUMBER
power.
Purpose
Raises e to the specified Oracle NUMBER
power.
Syntax
sword OCINumberExp ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberFloor()
Computes the floor (round down) value of an Oracle NUMBER
.
Purpose
Computes the floor (round down) value of an Oracle NUMBER
.
Syntax
sword OCINumberFloor ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberFromInt()
Converts an integer to an Oracle NUMBER
.
Purpose
Converts an integer to an Oracle NUMBER
.
Syntax
sword OCINumberFromInt ( OCIError *err, const void *inum, uword inum_length, uword inum_s_flag, OCINumber *number );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - inum (IN)
-
Pointer to the integer to convert.
- inum_length (IN)
-
Size of the integer.
- inum_s_flag (IN)
-
Flag that designates the sign of the integer, as follows:
-
OCI_NUMBER_UNSIGNED
- Unsigned values -
OCI_NUMBER
_SIGNED
- Signed values
Comments
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
.
Returns
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
.
Related Topics
OCINumberFromReal()
Converts a real (floating-point) type to an Oracle NUMBER
.
Purpose
Converts a real (floating-point) type to an Oracle NUMBER
.
Syntax
sword OCINumberFromReal ( OCIError *err, const void *rnum, uword rnum_length, OCINumber *number );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - rnum (IN)
-
Pointer to the floating-point number to convert.
- rnum_length (IN)
-
The size of the desired result, which equals
sizeof
({float
|double
|long double
}). - number (OUT)
-
Given float converted to Oracle
NUMBER
.
Comments
This is a native type conversion function. It converts a system-native floating-point type to an Oracle NUMBER
.
Returns
This function returns an error if number
or rnum
is NULL
, or if rnum_length
equals zero.
Related Topics
OCINumberFromText()
Converts a character string to an Oracle NUMBER
.
Purpose
Converts a character string to an Oracle NUMBER
.
Syntax
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 );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - str (IN)
-
Input string to convert to Oracle
NUMBER
. - str_length (IN)
-
Size of the input string.
- fmt (IN)
-
Conversion format.
- fmt_length (IN)
-
Length of the
fmt
parameter. - nls_params (IN)
-
Globalization support format specification. If it is the
NULL
string (""), then the default parameters for the session are used. - nls_p_length (IN)
-
Length of the
nls_params
parameter. - number (OUT)
-
Given string converted to
NUMBER
.
Comments
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.
Returns
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.
OCINumberHypCos()
Computes the hyperbolic cosine of an Oracle NUMBER
.
Purpose
Computes the hyperbolic cosine of an Oracle NUMBER
.
Syntax
sword OCINumberHypCos ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if either of the number
arguments is NULL
.
Note:
An Oracle NUMBER
overflow causes an unpredictable result value.
Related Topics
OCINumberHypSin()
Computes the hyperbolic sine of an Oracle NUMBER
.
Purpose
Computes the hyperbolic sine of an Oracle NUMBER
.
Syntax
sword OCINumberHypSin ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if either of the NUMBER
arguments is NULL
.
Note:
An Oracle NUMBER
overflow causes an unpredictable result value.
Related Topics
OCINumberHypTan()
Computes the hyperbolic tangent of an Oracle NUMBER
.
Purpose
Computes the hyperbolic tangent of an Oracle NUMBER
.
Syntax
sword OCINumberHypTan ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if either of the NUMBER
arguments is NULL
.
Note:
An Oracle NUMBER
overflow causes an unpredictable result value.
Related Topics
OCINumberInc()
Increments an Oracle NUMBER
.
Purpose
Increments an Oracle NUMBER
.
Syntax
sword OCINumberInc ( OCIError *err, OCINumber *number );
Parameters
Comments
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.
Returns
This function returns an error if the input NUMBER
is NULL
.
Related Topics
OCINumberIntPower()
Raises a given base to a given integer power.
Purpose
Raises a given base to a given integer power.
Syntax
sword OCINumberIntPower ( OCIError *err, const OCINumber *base, const sword exp, OCINumber *result );
Parameters
Returns
This function returns an error if either of the NUMBER
arguments is NULL
.
Related Topics
OCINumberIsInt()
Tests if an OCINumber is an integer.
Purpose
Tests if an OCINumber is an integer.
Syntax
sword OCINumberIsInt ( OCIError *err, const OCINumber *number, boolean *result );
Parameters
Returns
This function returns an error if number
or result
is NULL
.
Related Topics
OCINumberIsZero()
Tests if the given NUMBER
equals zero.
Purpose
Tests if the given NUMBER
equals zero.
Syntax
sword OCINumberIsZero ( OCIError *err, const OCINumber *number, boolean *result );
Parameters
Returns
This function returns an error if the NUMBER
argument is NULL
.
Related Topics
OCINumberLn()
Takes the natural logarithm (base e) of an Oracle NUMBER
.
Purpose
Takes the natural logarithm (base e) of an Oracle NUMBER
.
Syntax
sword OCINumberLn ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if either of the NUMBER
arguments is NULL
, or if number
is less than or equal to zero.
Related Topics
OCINumberLog()
Takes the logarithm, to any base, of an Oracle NUMBER
.
Purpose
Takes the logarithm, to any base, of an Oracle NUMBER
.
Syntax
sword OCINumberLog ( OCIError *err, const OCINumber *base, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if:
-
Any of the
NUMBER
arguments isNULL
-
The value of
number
<= 0 -
The value of
base
<= 0
Related Topics
OCINumberMod()
Gets the modulus (remainder) of the division of two Oracle NUMBER
s.
Purpose
Gets the modulus (remainder) of the division of two Oracle NUMBER
s.
Syntax
sword OCINumberMod ( OCIError *err, const OCINumber *number1, const OCINumber *number2, OCINumber *result );
Parameters
Returns
This function returns an error if number1
or number2
is NULL
, or if there is a divide-by-zero error.
Related Topics
OCINumberMul()
Multiplies one Oracle NUMBER
by another Oracle NUMBER
.
Purpose
Multiplies one Oracle NUMBER
by another Oracle NUMBER
.
Syntax
sword OCINumberMul ( OCIError *err, const OCINumber *number1, const OCINumber *number2, OCINumber *result );
Parameters
Comments
Multiplies number1
with number2
and returns the result in result
.
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberNeg()
Negates an Oracle NUMBER
.
Purpose
Negates an Oracle NUMBER
.
Syntax
sword OCINumberNeg ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if either of the NUMBER
arguments is NULL
.
Related Topics
OCINumberPower()
Raises a given base to a given exponent.
Purpose
Raises a given base to a given exponent.
Syntax
sword OCINumberPower ( OCIError *err, const OCINumber *base, const OCINumber *number, OCINumber *result );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - base (IN)
-
Base of the exponentiation.
- number (IN)
-
Exponent to which the base is to be raised.
- result (OUT)
-
Output of exponentiation.
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberPrec()
Rounds an OCINumber
to a specified number of decimal digits.
Purpose
Rounds an OCINumber
to a specified number of decimal digits.
Syntax
sword OCINumberPrec ( OCIError *err, const OCINumber *number, eword nDigs, OCINumber *result );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - number (IN)
-
The number for which to set precision.
- nDigs (IN)
-
The number of decimal digits desired in the result.
- result (OUT)
-
The result.
Comments
Performs a floating-point round with respect to the number of digits.
Returns
This function returns an error any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberRound()
Rounds an Oracle NUMBER
to a specified decimal place.
Purpose
Rounds an Oracle NUMBER
to a specified decimal place.
Syntax
sword OCINumberRound ( OCIError *err, const OCINumber *number, sword decplace, OCINumber *result );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - number (IN)
-
NUMBER
to round. - decplace (IN)
-
Number of decimal digits to the right of the decimal point to round to. Negative values are allowed.
- result (OUT)
-
Output of rounding.
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberSetPi()
Sets an OCINumber
to pi.
Purpose
Sets an OCINumber
to pi.
Syntax
void OCINumberSetPi ( OCIError *err, OCINumber *num );
Parameters
Comments
Initializes the given NUMBER
to the value of pi.
Related Topics
OCINumberSetZero()
Initializes an Oracle NUMBER
to zero.
Purpose
Initializes an Oracle NUMBER
to zero.
Syntax
void OCINumberSetZero ( OCIError *err OCINumber *num );
Parameters
Comments
None.
Related Topics
OCINumberShift()
Multiplies a NUMBER
by a power of 10 by shifting it a specified number of decimal places.
Purpose
Multiplies a NUMBER
by a power of 10 by shifting it a specified number of decimal places.
Syntax
sword OCINumberShift ( OCIError *err, const OCINumber *number, const sword nDig, OCINumber *result );
Parameters
Comments
Multiplies number
by 10^nDig
and sets product
to the result.
Returns
This function returns an error if the input number
is NULL
.
Related Topics
OCINumberSign()
Gets sign of an Oracle NUMBER
.
Purpose
Gets sign of an Oracle NUMBER
.
Syntax
sword OCINumberSign ( OCIError *err, const OCINumber *number, sword *result );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - number (IN)
-
Oracle
NUMBER
whose sign is returned. - result (OUT)
-
Table 28-13 lists the possible return values.
Table 28-13 Values of result
Value of number | Output in result Parameter |
---|---|
|
-1 |
|
0 |
|
1 |
Returns
This function returns an error if number
or result
is NULL
.
Related Topics
OCINumberSin()
Computes the sine in radians of an Oracle NUMBER
.
Purpose
Computes the sine in radians of an Oracle NUMBER
.
Syntax
sword OCINumberSin ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if either of the number
arguments is NULL
.
Related Topics
OCINumberSqrt()
Computes the square root of an Oracle NUMBER
.
Purpose
Computes the square root of an Oracle NUMBER
.
Syntax
sword OCINumberSqrt ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if number
is NULL
or number
is negative.
Related Topics
OCINumberSub()
Subtracts one Oracle NUMBER
from another Oracle NUMBER
.
Purpose
Subtracts one Oracle NUMBER
from another Oracle NUMBER
.
Syntax
sword OCINumberSub ( OCIError *err, const OCINumber *number1, const OCINumber *number2, OCINumber *result );
Parameters
Comments
Subtracts number2
from number1
and returns the result in result
.
Returns
This function returns an error if any of the number
arguments is NULL
.
Related Topics
OCINumberTan()
Computes the tangent in radians of an Oracle NUMBER
.
Purpose
Computes the tangent in radians of an Oracle NUMBER
.
Syntax
sword OCINumberTan ( OCIError *err, const OCINumber *number, OCINumber *result );
Parameters
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics
OCINumberToInt()
Converts an Oracle NUMBER
type to integer.
Purpose
Converts an Oracle NUMBER
type to integer.
Syntax
sword OCINumberToInt ( OCIError *err, const OCINumber *number, uword rsl_length, uword rsl_flag, void *rsl );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - number (IN)
-
Oracle
NUMBER
to convert. - rsl_length (IN)
-
Size of the desired result.
- rsl_flag (IN)
-
Flag that designates the sign of the output, as follows:
-
OCI_NUMBER_UNSIGNED
- Unsigned values -
OCI_NUMBER_SIGNED
- Signed values
Comments
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
.
Returns
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
.
Related Topics
OCINumberToReal()
Converts an Oracle NUMBER
type to a real type.
Purpose
Converts an Oracle NUMBER
type to a real type.
Syntax
sword OCINumberToReal ( OCIError *err, const OCINumber *number, uword rsl_length, void *rsl );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - number (IN)
-
Oracle
NUMBER
to convert. - rsl_length (IN)
-
The size of the desired result, which equals
sizeof
({float
|double
|long double
}). - rsl (OUT)
-
Pointer to space for storing the result.
Comments
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.
Related Topics
OCINumberToRealArray()
Converts an array of NUMBER
to an array of real type.
Purpose
Converts an array of NUMBER
to an array of real type.
Syntax
sword OCINumberToRealArray ( OCIError *err, const OCINumber **number, uword elems, uword rsl_length, void *rsl );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - number (IN)
-
Pointer to array of
NUMBER
to be converted. - elems (IN)
-
Maximum number of
NUMBER
pointers. - rsl_length (IN)
-
The size of the desired result, that is,
sizeof({ float | double | long double
})
. - rsl (OUT)
-
Pointer to array of space for storing the result.
Comments
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.
Returns
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.
Related Topics
OCINumberToText()
Converts an Oracle NUMBER
to a character string according to a specified format.
Purpose
Converts an Oracle NUMBER
to a character string according to a specified format.
Syntax
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 );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - number (IN)
-
Oracle
NUMBER
to convert. - fmt (IN)
-
Conversion format.
- fmt_length (IN)
-
Length of the
fmt
parameter. - nls_params (IN)
-
Globalization support format specification. If it is a
NULL
string ((text *)0
), then the default parameters for the session is used. - nls_p_length (IN)
-
Length of the
nls_params
parameter. - buf_size (IN)
-
Size of the buffer.
- buf (OUT)
-
Buffer into which the converted string is placed.
Comments
See the TO_NUMBER
conversion function described in the Oracle Database SQL Language Referencefor a description of format and globalization support parameters.
The converted number string is stored in buf
, up to a maximum of buf_size
bytes.
Returns
This function returns an error if:
-
The value of
number
orbuf
isNULL
-
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
Related Topics
OCINumberTrunc()
Truncates an Oracle NUMBER
at a specified decimal place.
Purpose
Truncates an Oracle NUMBER
at a specified decimal place.
Syntax
sword OCINumberTrunc ( OCIError *err, const OCINumber *number, sword decplace, OCINumber *result );
Parameters
- err (IN/OUT)
-
The OCI error handle. If there is an error, it is recorded in
err
, and this function returnsOCI_ERROR
. Obtain diagnostic information by callingOCIErrorGet()
. - number (IN)
-
Input
NUMBER
. - decplace (IN)
-
Number of decimal digits to the right of the decimal point at which to truncate. Negative values are allowed.
- result (OUT)
-
Output of truncation.
Returns
This function returns an error if any of the NUMBER
arguments is NULL
.
Related Topics