Use MASK_SUB to mask the specified length of characters starting from the startindex.

Syntax

/*+  MASK_SUB(column, startIndex [, length]) */

Arguments

  • column - name of table column.
  • startIndex - the starting digit for the mask.
  • length - the number of characters to mask. If unspecified, mask continues to end of string.

Examples

SELECT MASK_SUB(email, 6, 5), * FROM widgetcorp.sales.accounts.customers;

| RESULTS | id |  name | surname | email |
|---|---|---|---|---|
| egaffXXXXX2019.gov | 39772 | eddie | gaff | egaff@lapd2019.gov |
| holdeXXXXXurtle.com | 23381 | holden | holden.d@turtle.com |
| rick@XXXXXrn.co | 26354 | deckard | rick@unicorn.co |

SELECT MASK_SUB(email, 6), * FROM widgetcorp.sales.accounts.customers;

| RESULTS | id |  name | surname | email |
|---|---|---|---|---|
| egaffXXXXXXXXXXXXX | 39772 | eddie | gaff | egaff@lapd2019.gov |
| holdeXXXXXXXXXXXXXX | 23381 | holden | holden.d@turtle.com |
| rick@XXXXXXXXXX | 26354 | deckard | rick@unicorn.co |