Monday, January 23, 2006

adopts dbms_rls to restrict the table access

oracle provides a powerful feature that allows developer to audit the table access with user_customized function, here is the sample

create or replace function GEORGEY_SECURITY_FUNCTION return boolean is
Result boolean;
begin
raise_application_error(-20101, 'illegal access');

return(Result);
end GEORGEY_SECURITY_FUNCTION;

BEGIN

dbms_rls.add_policy(object_schema => 'GEORGEY',
object_name => 'PEOPLE',
policy_name => 'GEORGEY_POLICY',
function_schema => 'GEORGEY',
policy_function => 'GEORGEY_SECURITY_FUNCTION',
statement_types => 'SELECT,UPDATE,INSERT,DELETE',
update_check => TRUE,
enable => TRUE,
static_policy => FALSE);

END;