My Oracle Support Banner

DBMS_OUTPUT.PUT_LINE Fires Multiple Times From FGAC Policy Function (Doc ID 312030.1)

Last updated on MARCH 04, 2019

Applies to:

Oracle Database - Enterprise Edition - Version 9.2.0.5 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.

Symptoms

NOTE: In the images and/or the document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product. Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner. 

DBMS_OUTPUT.PUT_LINE fires multiple times from policy function in FGAC.

connect / as sysbda
create table user1.protected_table (a number);
insert into user1.protected_table values(10);
commit;
create or replace function sec_policy_function (p_schema in varchar2,
                                                p_object in varchar2)
    return varchar2
    as
    begin
      dbms_output.put_line('Table protected, No insert/update/delete allowed.');
      return '1=0';
    end;
/
exec dbms_rls.drop_policy( object_schema => 'user1', -
                           object_name   => 'PROTECTED_TABLE', -
                           policy_name   => 'PROTECTED_POL');
exec dbms_rls.add_policy( object_schema   => 'user1', -
                          object_name     => 'PROTECTED_TABLE',-
                          policy_name     => 'PROTECTED_POL',-
                          function_schema => 'SYS',-
                          policy_function => 'sec_policy_function',-
                          statement_types => 'insert, update, delete',-
                          update_check    => TRUE,-
                          enable          => TRUE );

 

SQL> connect user1/xxxx
Connected.
SQL> select * from user1.protected_table;
         A
----------
        10
1 row selected.
SQL> set serveroutput on
SQL> delete from protected_table;
    Table protected, No insert/update/delete allowed.
    Table protected, No insert/update/delete allowed.
SQL> update protected_table set a=30;
    Table protected, No insert/update/delete allowed.
    Table protected, No insert/update/delete allowed.
    Table protected, No insert/update/delete allowed.
    Table protected, No insert/update/delete allowed.
    0 rows updated.

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.