MySQL Enterprise Data Masking and De-Identification Function Descriptions • margin1 : A nonnegative integer that specifies the number of characters on the left end of the string to mask. If the value is 0, no left end characters are masked. • margin2 : A nonnegative integer that specifies the number of characters on the right end of the string to mask. If the value is 0, no right end characters are masked. • mask_char : (Optional) The single character to use for masking. The default is  ’X’  if  mask_char  is not given. The masking character must be a single-byte character. Attempts to use a multibyte character produce an error. Return value: The masked string, or  NULL  if either margin is negative. If the sum of the margin values is larger than the argument length, the entire argument is masked. Example: Masks a payment card Primary Account Number and returns the number with all but the last four digits replaced by  ’X’  characters. Arguments: Return value: The masked payment number as a string. If the argument is shorter than required, it is returned unchanged. Example: mysql>  SELECT mask_pan(gen_rnd_pan()); +-------------------------+ | mask_pan(gen_rnd_pan()) | +-------------------------+ | XXXXXXXXXXXX9102 | +-------------------------+ mysql>  SELECT mask_pan(gen_rnd_pan(19)); +---------------------------+ | mask_pan(gen_rnd_pan(19)) | +---------------------------+ mysql>  SELECT mask_outer(’abcdef’, 1, 2), mask_outer(’abcdef’,0, 5); +----------------------------+---------------------------+ | mask_outer(’abcdef’, 1, 2) | mask_outer(’abcdef’,0, 5) | +----------------------------+---------------------------+ | XbcdXX | aXXXXX | +----------------------------+---------------------------+ mysql>  SELECT mask_outer(’abcdef’, 1, 2, ’*’), mask_outer(’abcdef’,0, 5, ’#’); +---------------------------------+--------------------------------+ | mask_outer(’abcdef’, 1, 2, ’*’) | mask_outer(’abcdef’,0, 5, ’#’) | +---------------------------------+--------------------------------+ | *bcd** | a##### | +---------------------------------+--------------------------------+ • mask_pan( str ) • str : The string to mask. The string must be a suitable length for the Primary Account Number, but is not otherwise checked. 1586