【问题标题】:Is it possible to implement trigger that run on update in other schema是否可以实现在其他模式中更新时运行的触发器
【发布时间】:2016-11-06 11:09:48
【问题描述】:

我在同一台服务器上有两个数据库用户,例如test_usertest_customer

我的要求是在test_user 中创建一个触发器,该触发器将在插入用户test_usertest_customer 中的任何表时执行,例如Test_customer 中的cust_id 以及Test_user 中的user_id。

我该怎么做?

【问题讨论】:

  • 我已经提到两个用户在 oracle 中意味着两个模式
  • 你不能有一个触发“任何表”的触发器。触发器始终只附加到一个表。
  • 任意表表示两个不同数据库架构中的两个表

标签: sql plsql oracle11g database-trigger


【解决方案1】:

试试这个。这对我有用:

create trigger after_update_user

after update on db_test_user.user for each row
  update table db_test_customer.user set field = NEW.field where id = new.id;

【讨论】:

    猜你喜欢
    • 2011-02-02
    • 1970-01-01
    • 1970-01-01
    • 2021-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多