2014. 9. 18. 15:50

[Oracle] 16진수 <-> 10진수 변환

1. 16진수 -> 10진수

 

SELECT  TO_CHAR(15,'0X'), TO_CHAR(16,'0X'), TO_CHAR(17,'0X') 
  FROM  DUAL;

 >> OF   10   11

 

SELECT  TO_CHAR(15,'000X'), TO_CHAR(16,'000X'), TO_CHAR(17,'000X') 
  FROM  DUAL;

 >> 000F   0010   0011

 

 

2. 10진수 -> 16진수

 

SELECT  TO_NUMBER('F', 'XX')TO_NUMBER('10', 'XX'), TO_NUMBER('11', 'XX') 
  FROM  DUAL;

 >> 15   16   17

 

 

Trackback 0 Comment 0