IBM Books

SQL Reference

DOUBLE

Numeric to Double:

>>--+-DOUBLE-----------+---(--numeric-expression--)------------><
    +-FLOAT------------+
    '-DOUBLE_PRECISION-'
 

Character String to Double:

>>-DOUBLE--(--string-expression--)-----------------------------><
 

The schema is SYSIBM. However, the schema for DOUBLE(string-expression) is SYSFUN.

The DOUBLE function returns a floating-point number corresponding to a:

Numeric to Double

numeric-expression
The argument is an expression that returns a value of any built-in numeric data type.

The result of the function is a double-precision floating-point number. If the argument can be null, the result can be null; if the argument is null, the result is the null value.

The result is the same number that would occur if the argument were assigned to a double-precision floating-point column or variable.

Character String to Double

string-expression
The argument can be of type CHAR or VARCHAR in the form of a numeric constant. Leading and trailing blanks in argument are ignored.

The result of the function is a double-precision floating-point number. The result can be null; if the argument is null, the result is the null value.

The result is the same number that would occur if the string was considered a constant and assigned to a double-precision floating-point column or variable.

Example:

Using the EMPLOYEE table, find the ratio of salary to commission for employees whose commission is not zero. The columns involved (SALARY and COMM) have DECIMAL data types. To eliminate the possibility of out-of-range results, DOUBLE is applied to SALARY so that the division is carried out in floating point:

  SELECT EMPNO, DOUBLE(SALARY)/COMM
    FROM EMPLOYEE
    WHERE COMM > 0


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]