한글이름 가운데 마스킹
영문이름 5자 초과 기준으로 마스킹
with name_masking as (
SELECT '홍길동' AS name_1
union all
select 'HongGilDong'
union all
select 'Mark'
)
select name_1
,case when name_1 ~E'[A-Z|a-z]'
then case when length(name_1) >5
then rpad(left(name_1,5),length(name_1),'*')
else rpad(left(name_1,2),length(name_1),'*')
end
else left(name_1,1)||'*'||substring(name_1,3,length(name_1))
end "마스킹"
from name_masking;
'DataBase > SQL' 카테고리의 다른 글
일반 질의에서 case when 사용 (0) | 2010.05.18 |
---|---|
ORDER BY CONVERT (0) | 2010.05.18 |