MASK_COLUMN Function
The MASK_COLUMN function unmasks the column or alters the way masked data is displayed. This special function can be used in views to allow the control of delegated access to masked data.
MASK_COLUMN(expr AS {BASIC | NULL | 0 | ' ' | UNMASK})
Examples:
Create a view that unmasks the minimum, maximum, and average salaries. Queries against the view will display the actual data, not mask it. Permit everyone to view the data.
CREATE VIEW employee_salary_stats AS SELECT
MIN(MASK_COLUMN(salary AS UNMASK)) min_salary,
MAX(MASK_COLUMN(salary AS UNMASK)) max_salary,
AVG(MASK_COLUMN(salary AS UNMASK)) average_salary FROM employee;
GRANT select ON employee_salary_stats TO public;
Create a view in which the values for minimum, maximum, and average salary are shown as asterisks, not actual values. Permit everyone to view the data.
CREATE VIEW employee_salary_stats AS SELECT
MIN(MASK_COLUMN(salary AS BASIC)) min_salary,
MAX(MASK_COLUMN(salary AS BASIC)) max_salary,
AVG(MASK_COLUMN(salary AS BASIC)) average_salary FROM employee;
GRANT select ON employee_salary_stats TO public;
Last modified date: 04/03/2024