Oracle Virtual Private Database
What is VPD
VPD combines these two features, enabling you to enforce security policies to control access at the row level. This control is based on application or session attributes, which can be made available during execution.
CREATE OR REPLACE FUNCTION hide_sal_comm (
v_schema IN VARCHAR2,
v_objname IN VARCHAR2)
RETURN VARCHAR2 AS
con VARCHAR2 (200);
BEGIN
-- con := 'LINE_TYPE_LOOKUP_CODE=''ITEM''';
con := 'INVOICE_ID=81552';
RETURN (con);
END hide_sal_comm;
BEGIN
DBMS_RLS.ADD_POLICY (
object_schema => 'apps',
object_name => 'AP_INVOICE_LINES_ALL',
policy_name => 'hide_sal_policy',
policy_function => 'hide_sal_comm',
sec_relevant_cols => null);
END;
BEGIN
-- to drop a existing policy
DBMS_RLS.drop_POLICY (object_schema => 'APPS',
object_name => 'AP_INVOICE_LINES_ALL',
policy_name => 'hide_sal_policy');
END;
If you select
select * from AP_INVOICE_LINES_ALL only you can see 'INVOICE_ID=81552'
Comments
Post a Comment