Adding a new redaction policy:
begin
dbms_redact.add_policy(object_schema =< 'HR',
object_name =< 'EMPLOYEES',
column_name =< 'SALARY',
policy_name =< 'SALARY_REDACTION',
function_type =< dbms_redact.FULL,
expression =< 'SYS_CONTEXT(''USERENV'',''SESSION_USER'') != ''HR'' OR SYS_CONTEXT(''USERENV'',''SESSION_USER'') IS NULL'
);
end;
ORA-06550: line 6, column 43:
PLS-00201: identifier 'DBMS_REDACT' must be declaredSQL< connect sys/123456@pdborcl as sysdba;
Connected.Execute the add_policy again, you're all set.
select * from redaction_policies;
select first_name, last_name, salary from hr.employees;
Lex De Haan 0
EXEC DBMS_REDACT.DROP_POLICY('HR','EMPLOYEES','SALARY_REDACTION');
begin
dbms_redact.alter_policy(object_schema =< 'HR',
object_name =< 'EMPLOYEES',
policy_name =< 'SALARY_REDACTION',
action =< dbms_redact.MODIFY_COLUMN,
column_name =< 'SALARY',
function_type =< dbms_redact.partial,
function_parameters =< '9,1,8'
);
end;