Providing User-defined and Post-processing Functions

If desired, you can provide user-defined and post-processing functions on the Create Format page. A user-defined choice is available in the Add list, and a post-processing function field is available at the bottom of the page.

  • User-defined functions

    To provide a user-defined function, select User Defined Function from the Add list, then click Go to access the input fields.

    A user-defined function passes in the original value as input, and returns a mask value. The data type and uniqueness of the output values must be compatible with the original output values. Otherwise, a failure occurs when the job runs. Combinable, a user-defined function is a PL/SQL function that can be invoked in a SELECT statement. Its signature is returned as:

    Function udf_func (rowid varchar2, column_name varchar2, original_value varchar2) returns varchar2;
    
    • rowid is the min (rowid) of the rows that contain the value original_value 3rd argument.

    • column_name is the name of the column being masked.

    • original_value is the value being masked.

    That is, it accepts the original value as an input string, and returns the mask value.

    Both input and output values are varchar2. For instance, a user-defined function to mask a number could receive 100 as input, the string representation of the number 100, and return 99, the string representation of the number 99. Values are cast appropriately when inserting to the table. If the value is not castable, masking fails.

  • Post-processing functions

    To provide a post-processing function, enter it in the Post Processing Function field.

    A post-processing function has the same signature as a user-defined function, but passes in the mask value the masking engine generates, and returns the mask value that should be used for masking, as shown in the following example:

    Function post_proc_udf_func (rowid varchar2, column_name varchar2, mask_value varchar2) returns varchar2;
    
    • rowid is the min (rowid) of the rows that contain the value mask_value.

    • column_name is the name of the column being masked.

    • mask_value is the value being masked.