-----二進制轉換十進制-----------------
select sum(data1)
from (select substr('1101', rownum, 1) * power(2, length('1101') - rownum) data1
from dual
connect by rownum <= length('1101'))
-----八進制轉換十進制-----------------
select sum(data1)
from (select substr('1101', rownum, 1) * power(8, length('1101') - rownum) data1
from dual
connect by rownum <= length('1101'))
-----十六進制轉換十進制-----------------
select sum(data1)
from (select (CASE upper(substr('2D', rownum, 1))
WHEN 'A' THEN '10'
WHEN 'B' THEN '11'
WHEN 'C' THEN '12'
WHEN 'D' THEN '13'
WHEN 'E' THEN '14'
WHEN 'F' THEN '15'
ELSE substr('2D', rownum, 1)
END) * power(16, length('2D') - rownum) data1
from dual
connect by rownum <= length('2D'))