by 김성수 [SQL Query] [2015.04.14 15:53:56]
쿼리 : select rawtohex('ABC') from dual;
결과 : 414243
원하는값 : 004100420043
즉 각 문자별 앞에 00을 붙이고 싶습니다. 어떻게 해야 할까요???
이렇게 한번 해보았습니다.(자문 자답)ㅡㅡ;;
with aaa as ( select rawtohex('ABC') as col1 from dual ) select replace(WM_CONCAT(row1),',','') as message from ( select '00'||substr(col1,level,2) as row1, level from aaa where mod(level,2) = 1 connect by level <= length(col1) )
select
regexp_replace(col1,
'(.{2})'
,
'00\1'
)
from
aaa
SELECT REGEXP_REPLACE(RAWTOHEX('ABC'), '(.{2})', '00\1') FROM DUAL
한글 같은경우엔 문제의 내용이 애매해지네요.
한글은 성수님이 작성한 형태대로 해야겠네요