2015-04-21 27 views
2

我用下面的SQL创建了扳机的Oracle 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 

我不明白这一点。我与这两种方案都有联系,我从不想改变某些东西。哪里不对?

+0

这只是试图执行触发器的用户没有权限这样做。 –

回答

0

的特权似乎缺少,请执行,

grant create trigger to schemaname; 

如果仍然给出了错误,则选择权限可能会缺少对其他模式的表,对于您可以运行此,

grant select on otherschema.table_name to <schema_name> ; 
+0

我问db管理员授予我创建和使用触发器的权利,但我仍然遇到错误。 – Jonas

+0

EXTERNAL_SCHEME MY_SCHEMA 在这些鞋子中,您是否在使用表格? 需要将拨款授予正在创建触发器的模式 – anudeepks

+0

我在MY_SCHEMA上执行此操作,但我获得了EXTERNAL_SCHEME上的权限。对不起,从我错误的错误,感谢这解决了它。 – Jonas