DECFLOAT scalar function
The DECFLOAT function returns a decimal floating-point representation of either a number or a character string representation of a number, a decimal number, an integer, a floating-point number, or a decimal floating-point number.
Numeric to DECFLOAT:
String to DECFLOAT:
The schema is SYSIBM.
Numeric to DECFLOAT
- numeric-expression
- An expression that returns a value of any built-in numeric data type.
- 34 or 16
- Specifies the number of digits of precision for the result. The default is 34.
String to DECFLOAT
- string-expression
- An expression that returns a value of a character
or graphic string (except a CLOB or DBCLOB) with a length attribute
that is not greater than 255 bytes. Leading and trailing blanks are
eliminated, and the resulting string is folded to uppercase. The expression
must conform to the rules for forming a floating-point, decimal floating-point,
integer, or decimal constant.
Use the string-expression syntax variation to specify a negative zero as a constant, or to preserve the precision of a floating point constant.
- 34 or 16
- Specifies the number of digits of precision for the result. The default is 34.
The result is the same number that would result
from CAST(string-expression AS DECFLOAT(n))
or CAST(numeric-expression AS
DECFLOAT(n))
. Leading and trailing blanks are removed from
the string, and the resulting substring must conform to the rules
for forming a string representation of an SQL decimal-floating point
constant.
If necessary, the source is rounded to the precision of the target.
For static SQL statements other than CREATE VIEW, the ROUNDING bind option or the native SQL procedure option determines the rounding mode.
For dynamic SQL statements (and static CREATE VIEW statements), the special register CURRENT DECFLOAT ROUNDING MODE determines the rounding mode.
The result of the function is a DECFLOAT with the implicitly or explicitly specified number of digits of precision.
The result can be null; if the first argument is null, the result is the null value.
SELECT INFINITY -- column named SNAN
FROM MYTAB
WHERE C1 = DECFLOAT ('sNaN' ) -- comparison is made with the
-- decimal floating-point sNaN value