|
Sybernet / Supplied Functions Reference
Release 3.00 Oct 14, 2002 |
|
The str function converts numbers to characters, with optional arguments for specifying the length of the number (including sign, decimal point, and digits to the right and left of the decimal point), and the number of places after the decimal point.
Length and decimal arguments to str (if supplied) must be positive. The default length is 10. The default decimal is 0. The length should be long enough to accommodate the decimal point and the number's sign. The decimal portion of the result is rounded to fit within the specified length. If the integer portion of the number does not fit within the length, however, str returns a row of asterisks of the specified length.
A short approx_numeric is right-justified in the specified length, and a long approx_numeric is truncated to the specified number of decimal places.
FUNCTION STR
(
APPROX_NUMERIC NUMBER
, LENGTH NUMBER
, DECIMAL NUMBER
)
RETURN VARCHAR2;
| Parameter | Description |
|---|---|
approx_numeric |
The value to be formatted |
length |
Sets the number of characters to be returned (including the decimal point, all digits to the right and left of the decimal point, and blanks) |
decimal |
Sets the number of decimal digits to be returned. |
VARCHAR2
The following example illustrates how to call str.
select http.str(12.3456,10,2) from dual
----------------------------------
12.35