My Oracle Support Banner

Data Redaction returns NULL or Zero values in some scenarios (Doc ID 1677218.1)

Last updated on MARCH 15, 2019

Applies to:

Oracle Database - Enterprise Edition - Version 12.1.0.1 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Information in this document applies to any platform.

Symptoms

NOTE: In the images and/or the document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product. Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner. 

In some scenarios, data redaction returns NULL or Zero values instead of the partially redacted data pattern.

An example of partial redaction is below :

-- Observe the last 3 rows of the table EMPLOYEES

SQL> select EMPNO, ENAME from test_redact.EMPLOYEES;

     EMPNO ENAME
---------- ----------
      7788 USER1
      7839 MYUSER
      7844 USER2
      7876 2USER
      7900 USER3
      7902USER4
      7934 USER5
       123 AR
       123 A
       123 ARA


-- Observe the execution of REGEXP_REPLACE on the table data.


SQL> SELECT empno, REGEXP_REPLACE(ename,'[A-Za-z0-9]','x',3, 0, 'i') ename
FROM test_redact.EMPLOYEES;

     EMPNO ENAME
---------- ---------------
      7788 USxxx
      7839 MYxx
      7844 USxxxx
      7876 2Uxxx
      7900 USxxx
      7902 USxx
      7934 USxxxx
       123 AR
       123 A
       123 ARx

-- Partial redaction policy is applied.


SQL> begin
  2  DBMS_REDACT.ADD_POLICY(
  3  object_schema => 'TEST_REDACT'
, object_name => 'EMPLOYEES'
  4    5  , column_name => 'ENAME'
  6  , policy_name => 'ename_test'
  7  , function_type => DBMS_REDACT.REGEXP
, expression => '1=1'
, regexp_pattern => '[A-Za-z0-9]'
  8    9   10  , regexp_replace_string =>'x'
 11  , regexp_position => 3
 12  , regexp_occurrence => 0
 13  , regexp_match_parameter => 'i'
 14  );
 15  end;
 16  /

PL/SQL procedure successfully completed.


-- Observe the NULL values returned for two rows.


SQL> SELECT empno,ename FROM employees;

     EMPNO ENAME
---------- ---------------
     7788 USxxx
      7839 MYxx
      7844 USxxxx
      7876 2Uxxx
      7900 USxxx
      7902 USxx
      7934 USxxxx
       123
       123
       123 ARx



Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.