connect sys/change_on_install as sysdba drop user pxf cascade; create user pxf identified by pxf default tablespace users temporary tablespace temp; grant create session to pxf; grant create any context to pxf; grant create table to pxf; grant unlimited tablespace to pxf; grant create procedure to pxf; grant execute on dbms_rls to pxf; grant execute on dbms_session to pxf; create table pxf.emp as select * from scott.emp; connect pxf/pxf select * from emp; grant select on pxf.emp to public; connect scott/tiger select * from pxf.emp; connect pxf/pxf create or replace function predicate (pv_schema in varchar2, pv_object in varchar2) return varchar2 as begin return 'deptno != ''10'''; end; / begin dbms_rls.add_policy( object_schema => 'PXF', object_name => 'EMP', policy_name => 'PXFTEST', policy_function => 'PREDICATE'); end; / connect scott/tiger select * from pxf.emp;