基于值的审计
create or replace trigger trg2after update of salary on hr.t062ad11_b
referencing new as new old as old
for each row
begin
if :old.salary >= :new.salary then
raise_application_error(-20000, 'Modify lesser error.');
end if;
end;
/
create or replace trigger trg3
after update of salary on hr.t062ad11_b
referencing new as new old as old
for each row
begin
if :old.salary != :new.salary then
insert into tvalue
values (sys_context('userenv','os_user')||' ' ||sys_context('userenv','session_user') ||' '||
sys_context('userenv','current_user')||' '||sys_context('userenv','ip_address')||' '||sys_context('userenv','authentication_method')||' '
||to_char(sysdate,'YYYY-MM-DD:HH24:MI:SS')||' modified '||:new.salary||' '||:old.salary);
end if;
end;
/
oracle HR SYS 172.25.250.254 PASSWORD 2020-11-01:21:45:12 modified 48004 24002
oracle HR SYS 172.25.250.254 PASSWORD 2020-11-01:21:45:12 modified 40002 20001
oracle HR SYS 172.25.250.254 PASSWORD 2020-11-01:21:45:12 modified 20002 10001
oracle HR SYS 172.25.250.254 PASSWORD 2020-11-01:21:45:12 modified 10004 5002
页:
[1]