Oracle Number Function - Oracle/PLSQL BIN_TO_NUM Function






BIN_TO_NUM converts a binary number x to a NUMBER.

This Oracle tutorial explains how to use the Oracle/PLSQL BIN_TO_NUM function.

Syntax

The syntax for the Oracle/PLSQL BIN_TO_NUM function is:

BIN_TO_NUM( expr1, expr2, ... expr_n)

expr1, expr2, ... expr_n must be either 0 or 1 values.

Example


-- from   w w  w . j  a v a 2s.c o m
SQL> select bin_to_num(1) from dual;

BIN_TO_NUM(1)
-------------
            1

SQL> select bin_to_num(1,0) from dual;

BIN_TO_NUM(1,0)
---------------
              2

SQL> select bin_to_num(1,1) from dual;

BIN_TO_NUM(1,1)
---------------
              3

SQL> select bin_to_num(1,1,1,0) from dual;

BIN_TO_NUM(1,1,1,0)
-------------------
                 14

SQL> select bin_to_num(1,1,1,1) from dual;

BIN_TO_NUM(1,1,1,1)
-------------------
                 15

SQL>