Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 1.29 KB

File metadata and controls

36 lines (26 loc) · 1.29 KB
description
Returns a masked version of a string.

MASK

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

{% code title="MASK example" %}

SELECT MASK('abcd-ABCD-1234')
-- xxxx-XXXX-nnnn

{% endcode %}

{% code title="MASK example containing optional arguments." %}

SELECT MASK('abcd-ABCD-1234', 'U', 'u', '#')
-- uuuu-UUUU-####

{% endcode %}

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.

\