oracle中可否在触发器中执行存储过程?
发布网友
发布时间:2022-04-24 12:06
我来回答
共2个回答
热心网友
时间:2022-04-08 01:19
理论上是可以的.
-
这个跟SQL Server是一样的道理
-
触发器套存储过程:
cerate trigger tri_name
on tablename
for Action
as
create procere proc_name
as
....
....
这个存储过程里面就不能接受参数了
热心网友
时间:2022-04-08 02:37
给你一个案例。。。看了你就懂了
CREATE OR REPLACE TRIGGER trg_dropdeny
BEFORE DROP OR TRUNCATE ON DATABASE
BEGIN
DECLARE
CURSOR tb_list IS
SELECT owner, name FROM not_drop_list;
BEGIN
FOR tb_rd IN tb_list LOOP
IF (lower(tb_rd.name) = 'alltables' or
lower(tb_rd.name) = lower(ora_dict_obj_name())) and
(lower(tb_rd.owner) = lower(ora_dict_obj_owner())) THEN
raise_application_error(num => -20000,
msg => '重要业务表,不允许drop和truncate');
END IF;
END LOOP;
END;
END;
/