如果一个用户test获取了一下权限:grant connect,resource,dba to test;
那么建它下的某个表A的trigger,要求system用户的表B存(存取全部或部分)A表的同步数据
请问test用户还需要获取那些权限!
有人说有DBA,权限了完全可以创建了!
但是我在test用户创建system用户的表B时show errors时提示:表或试图不存在?
请问不是权限的问题是什么问题?
那么建它下的某个表A的trigger,要求system用户的表B存(存取全部或部分)A表的同步数据
请问test用户还需要获取那些权限!
有人说有DBA,权限了完全可以创建了!
但是我在test用户创建system用户的表B时show errors时提示:表或试图不存在?
请问不是权限的问题是什么问题?
grant select any table to test;
或grant select on xxxtable to test;如果你要delete,则:
grant select on xxxtable to test;
DML(delete/update/insert)触发器中不能使用DDL(CREATE,DROP,ALTER)语句,也不能使用事务控制语句(ROLLBACK, COMMIT,SAVEPOINT)。特别注意的是,在触发器的主体中引用的函数(function)/过程(procedure)中也不能有事物控制语句。〖小贴士(Tip)〗
系统级触发器(System Triggers)中可以使用DDL语句。
〖方法(Action)〗
去掉事务控制语句,或使用自治事务(autonomous transactions)完成DDL以及其它引起隐性提交当前事务的操作
All Data Definition Language (DDL) statements execute an implicit commit.
Even if you create a separate procedure, to execute the DDL statement, the
execution of the separate procedure within the trigger is still in the same
transaction, forcing a commit of any statement executed in the trigger and
hence causing the error ORA-04092.Use autonomous transactions to create the table:1) Create a procedure called my_procedure that will execute as an autonomous
transaction:SQL> create or replace procedure my_procedure
2 is
3 pragma AUTONOMOUS_TRANSACTION;
4 BEGIN
5 execute immediate 'CREATE TABLE my_table (id NUMBER)';
6 END;
7 /Procedure created.2) Create the trigger, that will call the autonomous procedure to create the
table:SQL> create or replace trigger my_trig after delete on emp
2 BEGIN
3 my_procedure;
4 END;
5 /Trigger created.