5 Replies Latest reply: Jul 30, 2012 10:50 AM by 592815 RSS

    Creating a Column-Level Oracle Virtual Private Database Policy

    592815
      Hi Experts,
      '
      I am learning Virtual Private Database and create Policy.
      how do I creating a salary column-Level Oracle Virtual Private Database Policy so that user can only see her salary other than employee.
      I found example at http://docs.oracle.com/cd/B28359_01/network.111/b28531/vpd.htm#i1008294

      CREATE OR REPLACE FUNCTION hide_sal_comm (
      v_schema IN VARCHAR2,
      v_objname IN VARCHAR2)

      RETURN VARCHAR2 AS
      con VARCHAR2 (200);

      BEGIN
      con := 'deptno=30';
      RETURN (con);
      END hide_sal_comm;
      /

      above put a fix value dpeno =30. but I need change to con:=user_id or user name.

      however, user name is dynamic value based on different user to run select SQL for employee table.

      Thanks for any example

      Thanks
      newdba