The partial mask, also known as the custom mask, is only supported for the character data type. This mask allows the values to be partially masked and enables hiding sensitive information as well as performing partial authentication of data. For example, a bank customer care representative may recognize a caller by validating a few characters in their email address, but the complete email address should not be provided to the representative. Use the prefix P: to set up the partial mask and define the masking rule as follows:
prefix,char[:maxchars][,suffix]
  • prefix—Specifies the number of unmasked characters that can be displayed at the beginning of the column value.
  • char[:maxchars]—Specifies a single printable ASCII character to be used to obfuscate the column value. maxChars (optional) specifies the maximum number of characters to mask using the given ASCII character, and the rest of the string is trimmed.
  • [,suffix]—(Optional) specifies the number of characters at the end of the column value that can be displayed unmasked.

The following table lists examples of how to use partial masks and how the masked result is displayed.

Original value Mask format Results Notes
John Smith P:1,X JXXXXXXXXX

prefix=1

char=X

First character is visible.
MA P:0,X XX

prefix=0

char=X

All characters are masked.
John Smith P:0,*:3 ***

prefix=0

char=*

:maxchars=:3

Maximum three characters are masked and rest of the string is trimmed.
8881234567 P:3,0,3 8880000567

prefix=3

char=0

suffix=3

First and the last three characters are visible, and the remaining characters in the middle are masked.
012345678 P:0,X,4 XXXXX5678

prefix=0

char=X

suffix=4

Last four characters are visible.
my@gmail.com P:1,*:4,4 m****.com

prefix=1

char=*

:maxchars=:4

suffix=4

First and the last four characters are visible. Four characters are marked with an asterisk.
m@m.com P:1,*:4,4 m**.com

prefix=1

char=*

:maxchars=:4

suffix=4

First and the last four characters are visible. After taking out the prefix and the suffix, because only two characters are left, they are marked with an asterisk.
012345678 P:9,X 012345678

prefix=9

char=X

All characters are visible since the given prefix value is equal to the number of characters in the original value.