Creating Oracle Virtual Private Database row-level policies
Oracle VPD row-level policies restrict users' access per row for a protected object. This means that two users who execute the same query against, for example, a table may, as a result, receive different number of rows.
Getting ready
See the Getting ready section of the recipe Creating different policy functions.
How to do it...
Connect to the database as a user who has appropriate privileges (for example, the user
maja
):$ sqlplus maja
Create a VPD policy (for example,
test_pol1
) that protects thehr.emp_vpd_test
table in the following way: it restrictsSELECT
operation based on a policy function (for example,no_access
).To test VPD policy created in the previous step, connect as the user
susan
to the database (keep in mind that she has theSELECT ANY TABLE
privilege) and try to access data in the tablehr.emp_vpd_test
.Connect to the database as a user who can create a VPD policy (for example, user...