Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DBMS_REDACT - Simple policy

user13117585Jun 12 2019 — edited Jun 12 2019

Hello everybody,

I have a question about data redaction. I can't create my policy and it's a very basic one. Can anybody advise? Just for the record, it is just an idea. I don't store passwords. It's just a way to make my example obvious.

Imagine the following table:

CREATE TABLE redact

(

  password varchar2(20)

);

INSERT INTO redact VALUES('banana');

INSERT INTO redact VALUES('apple');

COMMIT;

I want to have something like this when I select the table. First character to be visible, but not the rest:

b*****

a****

So, I created a policy like this:

BEGIN

DBMS_REDACT.ADD_POLICY(

  object_schema => user,

  object_name => 'redact',

  column_name => 'password',

  policy_name => 'redact_pwd',

  function_type => DBMS_REDACT.PARTIAL,

  function_parameters  => 'VVVVVVVVVVVVVVVVVVV,FVVVVVVVVVVVVVVVVVV,*,1,20',

  policy_description => '...',

  expression => '1=1'

); 

END;

/

Unfortunately, I have this exception:

Error report -

ORA-28085: The input and output lengths of the redaction do not match.

ORA-06512: at "SYS.DBMS_REDACT_INT", line 3

ORA-06512: at "SYS.DBMS_REDACT", line 42

ORA-06512: at line 2

28085. 00000 -  "The input and output lengths of the redaction do not match."

*Cause:    As specified, the redaction parameters produced an output

           with a length different to that of the input.

*Action:   Use regular expression redaction instead of partial redaction.

I don't understand since the source and masked strings are the same lenghts

Regards,

This post has been answered by AndrewSayer on Jun 12 2019
Jump to Answer
Comments
Post Details
Added on Jun 12 2019
4 comments
935 views