DEV Community

Fazlı Akça
Fazlı Akça

Posted on

SQL String Mask

SELECT
REG.register_full_name,
rpad(left(reg.register_name,1),length(reg.register_name)-1,'*') as "Adı",
rpad(left(reg.register_surname,1),length(reg.register_surname)-1,'*') as "Soyadı"
FROM HRMD_REGISTER REG;

SELECT
REG.register_full_name,
left(reg.register_name,1)||repeat('*',length(reg.register_name)-1) as "Adı",
left(reg.register_surname,1)||repeat('*',length(reg.register_surname)-1) as "Soyadı"
FROM HRMD_REGISTER REG;

SELECT
REG.register_full_name,
regexp_replace(reg.register_name,'\Y\w','*','g') as "Adı",
regexp_replace(reg.register_surname,'\w\Y','*','g') as "Soyadı"
FROM HRMD_REGISTER REG;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)