I need to mask the account number and name data from my reports. My table looks like this
ACC_NUM | NAME |
---|---|
100000111 | THISISMYNAME |
100000522 | EVAN DIMASATRIO |
100000631 | THIS IS MYNAME |
100000851 | RAUL HOLMES |
100000999 | RAUL HOLMES AGUSTINA |
I need to show the last 3 digits for the ACC_NUM
column and the first 3 digits from every word for the NAME
column. I can use CONCAT('xxxxxxx', RIGHT(ACC_NUM, 3))
for the ACC_NUM
column, but I can't find a way to mask the NAME
column.
My expected output is something like this
MASK_ACC | NAME |
---|---|
xxxxxxx111 | THIXXXXX |
xxxxxxx522 | EVAXXXXX DIMXXXXX |
xxxxxxx631 | THIXXXXX IS MYNXXXXX |
xxxxxxx851 | RAUXXXXX HOLXXXXX |
xxxxxxx851 | RAUXXXXX HOLXXXXX AGUXXXXX |
This is my dbfiddle link: https://dbfiddle.uk/3K_MpRoE
I found it everyone, I will use this query
REGEXP_REPLACE(NAME, '([A-Z]{3})([A-Z]+)', '\1****')
This is the dbfiddle: https://dbfiddle.uk/4QGiz9RF