Masking last characters with *

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
Hi all,

I'm trying to mask last 4 digits of the telephone numbers. Due to the no fixed length of the telephone numbers, I can't use segment mapping relying on the segment length. How can I substitute the last 4 digits independently from the length of the value?

Let me write some sample values and what I'd like to obtain:

Original values to mask:
012.3456789
023.45678901

What I'd like to get:
012.345****
023.4567****

Any help would be sincerely appreciated.
Regards.
Gianpiero
Photo of Gianpiero Piccolo

Gianpiero Piccolo

  • 2,336 Points 2k badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of David Newman

David Newman

  • 130 Points 100 badge 2x thumb
Official Response
The easiest way would be to put this in a post script.  Something like update table set phone= SUBSTR(phone,1,legnth(phone)-4+"****".  This might not be the exact SQL