I do not want a trigger to fire under certain conditions like running on some stored procedure.
I cannot disable the trigger. For ex. There is a table on which if records are deleted then the same is written to audit table. However if on the same table if records are deleted when bill is processed which is normal behaviour I do not want the trigger to fire. Please note I cannot disable the trigger because at that time there could be someone else deleting the record manually.
Solution
You may
add flag column in table.
In bill
or any process flag your data created or modified.
and use
"IF" statement or "WHEN" clause of the trigger to only fire
for certain pre-known value of a column.
CREATE
TRIGGER TRG_XYZ
after
insert on TBL_XYZ
for
each row
WHEN(NEW.BILL_FLG
!= 'Y')
begin
-------------
fine grained auditing oracle
SELECT policy_name, object_name, statement_type, os_user, db_user FROM dba_fga_audit_trail;
The following policy audits any queries of salaries greater than £50,000.
CONN sys/password AS sysdba
BEGIN
DBMS_FGA.add_policy(
object_schema => 'AUDIT_TEST',
object_name => 'EMP',
policy_name => 'SALARY_CHK_AUDIT',
audit_condition => 'SAL > 50000',
audit_column => 'SAL');
END;
/