Convert bit vector to number in oracle using BIN_TO_NUM function

By Santhosh N

This explains how to convert the bit vector to a number in the oracle using the BIN_TO_NUM conversion function.

There is a conversion function in oracle by the name, BIN_TO_NUM which converts bit vector to number.

Syntax: BIN_TO_NUM(n1, n2, n3, .. nn)

Here n1, n2, n3, ..nn represents the bits (either 0 or 1)

Ex1: SELECT BIN_TO_NUM(0,1) FROM dual;
This returns 1 as result

Ex2: SELECT BIN_TO_NUM(1,1,1) FROM dual;
This returns 7 as result

Related FAQs

Used to check if the column value is in numeric format
What is the real purpose of dual in oracle.
Listing all tables in Oracle depends on the user logged in and the schema one logs in
This explains how to convert the string to date format in oracle.
This explains how to convert the the given date or integer values to strings.
This explains how to replace the part(s) of the string with other string or char
Convert bit vector to number in oracle using BIN_TO_NUM function  (1789 Views)