IBM DB2 Query Toolbox - List triggers in Db2 database



Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

IBM Db2 Query Toolbox - List triggers in Db2 database

A consulta abaixo lista os gatilhos em um banco de dados com seus detalhes. Query below lists triggers in a database with their details.

Consulta - 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

Colunas

  • trigger_name - nome do gatilho
  • table_name - nome da tabela de gatilhos (para gatilhos de tabela) com o nome do esquema
  • ativação - tempo de ativação do gatilho: antes , depois ou em vez de
  • operação SQL específica do evento: inserir , atualizar ou excluir , vários eventos
  • status - status do gatilho
    • Ativo
    • Desabilitado
  • definição - definição SQL de gatilho

Linhas

  • Uma linha representa um gatilho
  • Escopo das linhas: todos os gatilhos encontrados em um banco de dados
  • Ordenado por nome do esquema, nome da tabela, nome do acionadorv

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

Resultado - Sample results


Copyright © Dataedo.