Adding policy to a group
In this recipe, create VPD policies as part of a policy group.
Getting ready
To complete this recipe, you'll need an existing user who has appropriate privileges (for example, maja
). If you completed previous recipes, drop all VPD policies using the DBMS_RLS.DROP_POLICY
procedure.
![](https://static.packt-cdn.com/products/9781782172123/graphics/2123_04_27.jpg)
Figure 27 - Drop policies
How to do it...
Connect to the database as a user who has appropriate privileges (for example, the user
maja
):$ sqlplus maja
Add
TEST_POL1
to policy grouppol_grp_A
.Add
TEST_COL
to policy grouppol_grp_A
.Add
TEST_POL2
to policy grouppol_grp_B
.Create a logon trigger.
Connect to the database as the user
joel
using SQL*Plus and execute theSELECT
statement, as shown in Figure 32.Figure 32
View data in the table
hr.emp_vpd_test
.Figure 33
Connect to the database as the user
susan
using SQL*Plus and view data in the tablehr.emp_vpd_test
:SQL> connect susan
Connect as the user
emma
using SQL Developer and view data in the tablehr.emp_vpd_test
.