在数据库上运行一些DDL时,我注意到以下内容
我的用户ID似乎没有更换触发器的权限:
CREATE OR REPLACE TRIGGER MY_TRIGGER
<trigger definition follows>
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0551N The statement failed because the authorization ID does not have the
required authorization or privilege to perform the operation. Authorization
ID: "DB2INST1". Operation: "REPLACE TRIGGER". Object:
"MYSCHEMA.MY_TRIGGER". LINE NUMBER=1. SQLSTATE=42501
然而,它能够DROP和CREATE
DROP TRIGGER MY_TRIGGER
DB20000I The SQL command completed successfully.
CREATE TRIGGER MY_TRIGGER
<trigger definition follows>
DB20000I The SQL command completed successfully.
所以我的问题是:
答案 0 :(得分:2)
从documentation“要替换现有触发器,语句的授权标识必须是现有触发器的所有者(SQLSTATE 42501)。”
如果您的authid创建了触发器,那么您的authid可以替换它。
根据您的错误消息,创建触发器的帐户似乎与尝试替换它的帐户不同。