Creating a column-level Virtual Private Database
In addition to row-level security, the same Oracle packages also provide the ability to create column-level security.
Getting ready
Oracle also supports column masking as an option with VPD. This allows the database to apply a security function to determine whether a column within a row being returned should be masked or not. Log into SQL Developer as the schema owner from the previous recipe.
How to do it...
Column masking or column-level VPD is very useful to mask and hide sensitive information within a row. For example, Social Security numbers, and so on. The rules that enforce column masking are enforced the same way as row-level security with the business rules in a function and a policy to enforce the function:
1. Create a function which will secure the columns:
CREATE OR REPLACE FUNCTION USAGE_COL_SEC ( p_schema IN VARCHAR2 DEFAULT NULL, P_object IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2 IS CURSOR GET_GROUP IS SELECT GROUP_CODE FROM LDAP_USER_GROUP...