I tried to create a simple function like this but it not working. Data is returned but it's the same as if there were no policy.
CREATE OR REPLACE FUNCTION test (schema in varchar2, tab in varchar2)
RETURN varchar2 AS
predicate varchar2(4000);
pre2 VARCHAR2(2000);
BEGIN
pre2 := sa_session.SA_USER_NAME('policy');
predicate := '"USER" = '''|| pre2 ||'''';
return (predicate);
END test;
/
I will use this function with a VPD policy so when a user selects from a table, they can select only their row.