Oracle - PL/SQL - BIN_TO_NUM Function

The BIN_TO_NUM function converts a bit vector to its equivalent number. BIN_TO_NUM is useful in data warehousing applications for selecting groups of interest using grouping sets.

The syntax for the bin_to_num function is:

bin_to_num( expr1, expr2, ... expr_n)

expr1, expr2, ... expr_n must be either 0 or 1 values. They represent bits in a bit vector.

Applies To:

· Oracle 9i, Oracle 10g, Oracle 11g

For example:

bin_to_num(1)

would return 1

bin_to_num(1,0)

would return 2

bin_to_num(1,1)

would return 3

bin_to_num(1,1,1,0)

would return 14

bin_to_num(1,1,1,1)

would return 15