Bo's Oracle Station

查看: 1278|回复: 0

基于值的审计

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2020-11-1 21:34:07 | 显示全部楼层 |阅读模式
  1. create or replace trigger trg2
  2. after update of salary on hr.t062ad11_b
  3. referencing new as new old as old
  4. for each row
  5. begin
  6.   if :old.salary >= :new.salary then
  7.      raise_application_error(-20000, 'Modify lesser error.');      
  8.   end if;
  9. end;
  10. /
复制代码
  1. create or replace trigger trg3
  2. after update of salary on hr.t062ad11_b
  3. referencing new as new old as old
  4. for each row
  5. begin
  6.   if :old.salary != :new.salary then
  7.      insert into tvalue
  8.       values (sys_context('userenv','os_user')||' ' ||sys_context('userenv','session_user') ||' '||
  9.              sys_context('userenv','current_user')||' '||sys_context('userenv','ip_address')||' '||sys_context('userenv','authentication_method')||' '
  10.       ||to_char(sysdate,'YYYY-MM-DD:HH24:MI:SS')||' modified '||:new.salary||' '||:old.salary);      
  11.   end if;
  12. end;
  13. /

复制代码

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
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-11-23 17:58 , Processed in 0.044734 second(s), 24 queries .

快速回复 返回顶部 返回列表