content_image/846060.jpg
## General-Purpose Masking Functions 

mask_inner()  and mask_outer()  are general-purpose functions that mask parts of arbitrary strings based on position within the string: 

• mask_inner()  masks the interior of its string argument, leaving the ends unmasked. Other arguments specify the sizes of the unmasked ends. 

mysql> SELECT mask_inner(’This is a string’, 5, 1); +--------------------------------------+ | mask_inner(’This is a string’, 5, 1) | +--------------------------------------+ | This XXXXXXXXXXg | +--------------------------------------+ mysql> SELECT mask_inner(’This is a string’, 1, 5); +--------------------------------------+ | mask_inner(’This is a string’, 1, 5) | +--------------------------------------+ | TXXXXXXXXXXtring | +--------------------------------------+ 

• mask_outer()  does the reverse, masking the ends of its string argument, leaving the interior unmasked. Other arguments specify the sizes of the masked ends. 

mysql> SELECT mask_outer(’This is a string’, 5, 1); +--------------------------------------+ | mask_outer(’This is a string’, 5, 1) | +--------------------------------------+ | XXXXXis a strinX | +--------------------------------------+ mysql> SELECT mask_outer(’This is a string’, 1, 5); +--------------------------------------+ | mask_outer(’This is a string’, 1, 5) | +--------------------------------------+ | Xhis is a sXXXXX | +--------------------------------------+ 

By default, mask_inner()  and mask_outer()  use ’X’  as the masking character, but permit an optional masking-character argument: 

## Special-Purpose Masking Functions 

mysql> SELECT mask_inner(’This is a string’, 5, 1, ’*’); +-------------------------------------------+ | mask_inner(’This is a string’, 5, 1, ’*’) | +-------------------------------------------+ | This **********g | +-------------------------------------------+ mysql> SELECT mask_outer(’This is a string’, 5, 1, ’#’); +-------------------------------------------+ | mask_outer(’This is a string’, 5, 1, ’#’) | +-------------------------------------------+ | #####is a strin# | +-------------------------------------------+ 

Other masking functions expect a string argument representing a specific type of value and mask it to remove identifying characteristics. 

<img src='content_image/846060.jpg'>

## Note 

The examples here supply function arguments using the random value generation functions that return the appropriate type of value. For more information about generation functions, see Generating Random Data with Specific Characteristics. 

