Hi , I am using 11.2.0.3.0 version of oracle.


I am trying below VPD policy function on one of my column and i am expecting the column value to be shown as null when the table is being queried from USER1 and USER2. But i am not able to get it, its showing all the text values.
(Note-I dont want to put the restriction on SCHEMA(USER1,USER2) level for all objects using default 'EXEMPT ACCESS POLICY', so i have revoked the same from USER1,USER2 and trying to achive the same using below policy function.)

BEGIN
DBMS_RLS.ADD_POLICY (object_schema => 'USER1',
object_name => 'tde_test',
policy_name => 'test_vpd',
function_schema => 'USER1',
policy_function => 'vpd_function',
sec_relevant_cols => 'COL1',
sec_relevant_cols_opt => DBMS_RLS.ALL_ROWS);
END;
/

CREATE OR REPLACE FUNCTION vpd_function (obj_owner IN VARCHAR2,
obj_name IN VARCHAR2)
RETURN VARCHAR2
AS
BEGIN
IF SYS_CONTEXT ('USERENV', 'SESSION_USER') IN ('USER1','USER2')
THEN
RETURN '1=2';
ELSE
RETURN NULL;
END IF;
END;
/