oracle触发器样例

前端之家收集整理的这篇文章主要介绍了oracle触发器样例前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
触发器样例

create trigger logon_ip_control
after logon on database
declare
  ip STRING(30);
  user STRING(30);
begin
SELECT SYS_CONTEXT('USERENV','SESSION_USER') into user from dual;
SELECT SYS_CONTEXT('USERENV','IP_ADDRESS') into ip from dual;
if user='batter' 
  THEN
      IF ip not in ('192.168.1.84','192.168.2.235','192.168.1.166','192.168.1.237','192.168.1.228','192.168.1.113') 
      THEN raise_application_error(-20001,'用户 '||user||' 由于权限过大,现已回收);
      END IF;
END IF;
end;

猜你在找的Oracle相关文章