分类: Oracle
2008-04-03 22:44:45
CREATE OR REPLACE
FUNCTION rls_dept (obj_owner IN VARCHAR2, obj_name IN VARCHAR2)
RETURN VARCHAR2
AS
predicate VARCHAR2 (200);
BEGIN
predicate := 'department_id = 60';
RETURN (predicate);
END rls_dept;
/
BEGIN
DBMS_RLS.ADD_POLICY(object_schema=>'HR',
object_name=>'EMPLOYEES',
policy_name=>'restrict_dept_policy',
function_schema=>'HR',
policy_function=>'rls_dept',
sec_relevant_cols=>'salary,commission_pct',
sec_relevant_cols_opt=>dbms_rls.ALL_ROWS);
END;
/