有两张表:
1.页面权限表(power_page_auth)
主键:pw_id
状态:status
2.页面按钮权限表 (power_button_auth)
没有主键
状态:status如果现在做update操作,将页面权限表(power_page_auth)中的状态修改为停用(status=2)时
同时触发页面按钮权限表 (power_button_auth)中pw_id的所有按钮状态update成2怎么才可以实现?
1.页面权限表(power_page_auth)
主键:pw_id
状态:status
2.页面按钮权限表 (power_button_auth)
没有主键
状态:status如果现在做update操作,将页面权限表(power_page_auth)中的状态修改为停用(status=2)时
同时触发页面按钮权限表 (power_button_auth)中pw_id的所有按钮状态update成2怎么才可以实现?
after update on power_page_auth
for each row
declare
-- local variables here
begin
if (:old.status='2') then
update power_button_auth setstatus='2' where pw_id=:old.pw_id;
end if;
end bbb_update;
after update on power_page_auth
for each row
declare
-- local variables here
begin
if (:new.status='2') then
update power_button_auth setstatus='2' where pw_id=:new.pw_id;
end if;
end bbb_update;
CREATE OR REPLACE TRIGGER bufer_power_page_auth_status
AFTER update on power_page_auth
for each row
begin
if :new.status=2 then
update power_button_auth set status = 2 where pw_id = :old.pw_id;
end if;
end;结贴!
CREATE OR REPLACE TRIGGER bufer_power_page_auth_status
AFTER update on power_page_auth
for each row
begin
if :new.status=2 then
update power_button_auth set status = 2 where pw_id = :old.pw_id;
end if;
end;
结贴!
我自己修改了一下刚才那个触发器
CREATE OR REPLACE TRIGGER bufer_power_page_auth_status
AFTER update on power_page_auth
for each row
begin
if :new.status=2 then
update power_page_auth set end_dt = sysdate where pw_id = :old.pw_id;
update power_button_auth set status = 2,end_dt = sysdate where pw_id = :old.pw_id;
end if;
end;
可是触发器可以建立,执行update操作的时候报
update power_page_auth set status=2 where pw_id = 295
*
ERROR 位于第 1 行:
ORA-04091: 表 PRODUCTOA_USER.POWER_PAGE_AUTH 发生了变化,触发器/函数不能读
ORA-06512: 在"PRODUCTOA_USER.BUFER_POWER_PAGE_AUTH_STATUS", line 3
ORA-04088: 触发器 'PRODUCTOA_USER.BUFER_POWER_PAGE_AUTH_STATUS' 执行过程中出错