Oracle® Database SQL Reference 10g Release 2 (10.2) Part Number B14200-02 |
|
|
PDF · Mobi · ePub |
BIN_TO_NUM
converts a bit vector to its equivalent number. Each argument to this function represents a bit in the bit vector. This function takes as arguments any numeric datatype, or any nonnumeric datatype that can be implicitly converted to NUMBER
. Each expr
must evaluate to 0 or 1. This function returns Oracle NUMBER
.
BIN_TO_NUM
is useful in data warehousing applications for selecting groups of interest from a materialized view using grouping sets.
See Also:
group_by_clause for information on GROUPING
SETS
syntax
Table 2-10, "Implicit Type Conversion Matrix" for more information on implicit conversion
Oracle Data Warehousing Guide for information on data aggregation in general
The following example converts a binary value to a number:
SELECT BIN_TO_NUM(1,0,1,0) FROM DUAL; BIN_TO_NUM(1,0,1,0) ------------------- 10