Oracle sql,触发不同方案中的表

时间:2015-04-21 08:23:57

标签: oracle triggers insert

我使用以下sql来创建我的触发器

CREATE OR REPLACE TRIGGER INSERT_LOG
AFTER INSERT 
ON EXTERNAL_SCHEME.PAYMENT
FOR EACH ROW

BEGIN
INSERT INTO MY_SCHEMA.DM_LOGGER(ID, TECHNOLOGY, WORKFLOW, NAME_EVENT, TIME_EVENT)
VALUES (PAYMENT.id, 'Repository', 'UP', (select repo.name from
pay_repository repo join pay_pmt pay on repo.id = pay_pmt.repository_id
where repo.id = pay.repository_id),(select to_char(SYSDATE, 'hh24:mi:ss') from dual));
END;

当我执行此触发器时,我得到以下异常:

01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.

When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.

*Action:   Ask the database administrator to perform the operation or grant
the required privileges.

For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label

我不明白。我与两种方案都有联系,我从不想改变一些东西。有什么问题?

1 个答案:

答案 0 :(得分:0)

特权似乎缺失,请执行,

grant create trigger to schemaname;

如果它仍然提供错误,那么其他模式的表上可能缺少select权限,因为你可以运行它,

grant select on otherschema.table_name to <schema_name> ;