Categories: String
MASK
Returns a masked version of a string.
Syntax
MASK(expression varchar, uc_mask varchar, lc_mask varchar, num_mask varchar) → varchar
- expression: The string to mask.
- uc_mask: Controls the mask character for upper case letters.
- lc_mask: Controls the mask character for lower case letters.
- num_mask: Controls the mask character for numbers.
Examples
MASK exampleSELECT MASK('abcd-ABCD-1234')
-- xxxx-XXXX-nnnn
SELECT MASK('abcd-ABCD-1234', 'U', 'u', '#')
-- uuuu-UUUU-####
Usage Notes
By default, upper case letters are converted to X
, lower case letters are converted to x
, and numbers are converted to n
. You can override the characters used in the mask by supplying optional arguments. The first argument controls the mask character for upper case letters, the second argument for lower case letters, and the third argument for numbers.
Was this page helpful?
Glad to hear it! Thank you for your feedback.
Sorry to hear that. Thank you for your feedback.