Query below lists triggers in a database with their details.
Query
select
trigname as trigger_name,
tabschema concat '.' concat tabname as table_name,
case trigtime
when 'B' then 'before'
when 'A' then 'after'
when 'I' then 'instead of'
end as activation,
rtrim(case when eventupdate ='Y' then 'update ' else '' end
concat
case when eventdelete ='Y' then 'delete ' else '' end
concat
case when eventinsert ='Y' then 'insert ' else '' end)
as event,
case when ENABLED = 'N' then 'disabled'
else 'active' end as status,
text as definition
from syscat.triggers t
where tabschema not like 'SYS%'
order by trigname
Columns
- trigger_name - name of the trigger
- table_name - name of the trigger table (for table triggers) with schema name
- activation - trigger activation time: before, after or instead of
- event - specific SQL operation: insert, update or delete, multiple events
- status - trigger status
- Active
- Disabled
- definition - SQL definiton of trigger
Rows
- One row represents one trigger
- Scope of rows: all found triggers in a database
- Ordered by schema name, table name, trigger name