Google
Information Storage and Retrieval: Binary to Decimal (SQL Puzzle 13)

Pages

Monday, July 21, 2008

Binary to Decimal (SQL Puzzle 13)

Problem: Write an SQL query to convert a binary number to its Decimal equivalent.
Solution:
select sum(substr(&binary_number,rownum,1)*power(2,length(&binary_number)-rownum)) decimal_number from all_objects
where rownum<=length(&binary_number)

1 comment:

Anonymous said...

Nice post. I was checking continuously this blog and I am impressed!
Extremely helpful information particularly the last part :) I care for
such information a lot. I was looking for this certain info for a long time.
Thank you and best of luck.

my blog top online casinos (http://oboeguilty27.jigsy.com/entries/general/Steps-For-making-Your-Best-Online-Casinos-A-Success)