[16진수 -> 2진수 로 변환]
SELECT REPLACE(MAX (SYS_CONNECT_BY_PATH(bit, ',')), ',') bin
FROM
(
SELECT COUNT (*) OVER () - LEVEL + 1 level#
, DECODE (TRUNC (deci / POWER (2, LEVEL)),ROUND (deci / POWER (2, LEVEL)), 0,1) bit
FROM
(
SELECT 2911 deci
FROM DUAL
)
CONNECT BY POWER (2, LEVEL - 1) <= deci
)
CONNECT BY PRIOR level# = level# - 1
START WITH level# = 1
결과 : 101101011111
[확인]
SELECT BIN_TO_NUM (1,0,1,1,0,1,0,1,1,1,1,1)
FROM DUAL
결과 : 2911
728x90
'Carpe Programming > oracle' 카테고리의 다른 글
[orcale] 문자열 패턴 개수 추출 (0) | 2012.02.16 |
---|---|
[oracle] 진수 변환 (0) | 2012.02.16 |
[oracle] Hash Join 테이블 조인순서 바꾸기 (0) | 2012.02.13 |
[oracle] JDBC driver 종류 (0) | 2012.02.10 |
[oracle] hint (0) | 2012.02.10 |