MASK_PAN_RELAXED()

MASK_PAN_RELAXED() — Masks all but the first six and last four digits of a credit or payment card number.

Synopsis

MASK_PAN_RELAXED( string-expression )

Description

The MASK_PAN_RELAXED() function returns the specified string expression with all but the first six and last four digits replaced by the character X. For a credit card this displays the issuer identifier as well as the last four digits. Separators included in the string expression are ignored and carried through unchanged into the output. For example, the output of MASK_PAN_RELAXED('4111-1111-1111-1111') is the string '4111-11XX-XXXX-1111', where all but the issuer identifier and last four digits are masked. To change the number of leading digits displayed or the mask character, use the function MASK_CCN().

Example

The following example creates a VIEW using the MASK_PAN_RELAXED() function to mask all but the first six and last four digits of each credit card number.

CREATE VIEW payments AS
   SELECT last_name, MASK_PAN_RELAXED(credit_card_number), 
      date, amount
         FROM customer_payments ORDER BY date DESC;