Link to home
Start Free TrialLog in
Avatar of Leo Torres
Leo TorresFlag for United States of America

asked on

SQL Trigger

Would it be possible to write a trigger at the database level that looks at every table on the server and gathers the user name, Table name and action(select,Update,Insert Delete)?

I would like to collect this data and store it in a table.
Avatar of HainKurt
HainKurt
Flag of Canada image

no such thing...

https://docs.oracle.com/cd/B19306_01/server.102/b14220/triggers.htm#i6061

You can write triggers that fire whenever one of the following operations occurs:

DML statements (INSERT, UPDATE, DELETE) on a particular table or view, issued by any user

DDL statements (CREATE or ALTER primarily) issued either by a particular schema/user or by any schema/user in the database

Database events, such as logon/logoff, errors, or startup/shutdown, also issued either by a particular schema/user or by any schema/user in the database

and DML's are associated with tables...
Avatar of Leo Torres

ASKER

OK got it so no selects then. This doc is Oracle i am referring to SQL. I would imagine its the same thing.  Cant I create a DML trigger at the Database level?
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial