Dynamic Data Masking
- Dynamic Data Masking 9.8.4
- All Products
CREATE OR REPLACE FUNCTION test_senior_manager (position VARCHAR) RETURN INTEGER AS manager_type VARCHAR(50) ; BEGIN manager_type := retrieve_manager_type(position) ; IF manager_type = 'SENIOR' THEN RETURN 0; ELSE RETURN 1; END IF; END ;
CREATE OR REPLACE TYPE LIST_TYPE IS VARRAY (5) OF VARCHAR(50); CREATE OR REPLACE FUNCTION test_usage_type (db_user VARCHAR2, statement VARCHAR2, usages VARCHAR2) RETURN INTEGER AS usage_list LIST_TYPE; BEGIN IF db_user = 'SCOTT' THEN IF is_usage_type_col_in_tables(statement) THEN usage_list := spiltSemicolonList(usages); IF check_usages(usage_list) THEN RETURN 1; -- If there is a usage in security rule that implies masking is needed then return 1 ELSE RETURN 0; END IF ; ELSE RETURN 0; END IF; ELSE RETURN 0; END IF; END;
CREATE OR REPLACE FUNCTION test_a_few_params (os_user VARCHAR2, statement VARCHAR2) RETURN INTEGER AS stmt_contains_prod_tables BOOLEAN ; os_user_is_su BOOLEAN ; needs_masking BOOLEAN ; BEGIN stmt_contains_prod_tables := is_stmt_contains_prod_tables (statement) ; os_user_is_su := is_su (os_user) ; needs_masking := os_user_is_su AND stmt_contains_prod_tables; IF needs_masking THEN RETURN 1; ELSE RETURN 0; END IF; END ;