返回顶部
首页 > 资讯 > 数据库 >我们如何使用 INFORMATION_SCHEMA 来获取特定数据库中触发器的详细信息?
  • 291
分享到

我们如何使用 INFORMATION_SCHEMA 来获取特定数据库中触发器的详细信息?

2023-10-22 10:10:39 291人浏览 安东尼
摘要

可以借助以下语句来完成 -Mysql> select * from infORMation_schema.triggers where -> information_schema.triggers.t

可以借助以下语句来完成 -

Mysql> select * from infORMation_schema.triggers where
    -> information_schema.triggers.trigger_schema like '%query%'\G
*************************** 1. row ***************************
            TRIGGER_CATALOG: def
             TRIGGER_SCHEMA: query
               TRIGGER_NAME: trigger_before_delete_sample
         EVENT_MANIPULATION: DELETE
       EVENT_OBJECT_CATALOG: def
        EVENT_OBJECT_SCHEMA: query
         EVENT_OBJECT_TABLE: sample
               ACTION_ORDER: 1
           ACTION_CONDITION: NULL
           ACTION_STATEMENT: BEGIN
SET @count = if (@count IS NULL, 1, (@count+1));
INSERT INTO sample_rowaffected values (@count);
END
         ACTION_ORIENTATION: ROW
              ACTION_TIMING: BEFORE
 ACTION_REFERENCE_OLD_TABLE: NULL
 ACTION_REFERENCE_NEW_TABLE: NULL
   ACTION_REFERENCE_OLD_ROW: OLD
   ACTION_REFERENCE_NEW_ROW: NEW
                    CREATED: 2017-11-21 12:31:58.70
                   sql_MODE: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
                    DEFINER: root@localhost
       CHARACTER_SET_CLIENT: cp850
       COLLATION_CONNECTION: cp850_general_ci
         DATABASE_COLLATION: latin1_swedish_ci
*************************** 2. row ***************************
           TRIGGER_CATALOG: def
            TRIGGER_SCHEMA: query
              TRIGGER_NAME: before_inser_studentage
        EVENT_MANIPULATION: INSERT
      EVENT_OBJECT_CATALOG: def
       EVENT_OBJECT_SCHEMA: query
        EVENT_OBJECT_TABLE: student_age
              ACTION_ORDER: 1
          ACTION_CONDITION: NULL
          ACTION_STATEMENT: IF NEW.age < 0 THEN SET NEW.age = 0;
END IF
        ACTION_ORIENTATION: ROW
             ACTION_TIMING: BEFORE
ACTION_REFERENCE_OLD_TABLE: NULL
ACTION_REFERENCE_NEW_TABLE: NULL
  ACTION_REFERENCE_OLD_ROW: OLD
  ACTION_REFERENCE_NEW_ROW: NEW
                   CREATED: 2017-11-21 11:26:15.34
                  SQL_MODE: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
                   DEFINER: root@localhost
      CHARACTER_SET_CLIENT: cp850
      COLLATION_CONNECTION: cp850_general_ci
        DATABASE_COLLATION: latin1_swedish_ci

2 rows in set (0.03 sec)
您可能感兴趣的文档:

--结束END--

本文标题: 我们如何使用 INFORMATION_SCHEMA 来获取特定数据库中触发器的详细信息?

本文链接: https://lsjlt.com/news/437181.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作