Oracle触发器实例

实例一

create or replace trigger update_portaUser_pass
  after update on cas_porta_user
  for each row
declare
  -- local variables here
begin
  update security_credential c set c.column_value=:NEW.COLUMN_VALUE where  c.principal_id in (select p.principal_id from security_principal p where p.full_path=:NEW.FULL_PATH);

end;

实例二

create or replace trigger Inser_casUser
  after insert on cas_user  
  for each row
declare
  -- local variables here
begin

  IF :NEW.type=1 then
        insert into cas_user_group(userID,gid) values(:NEW.userID,'578d3369633b47bd9c1fe8bf905cbfb1');
 else
      insert into cas_user_group(userID,gid) values(:NEW.userID,'387bcd57fc5a4c3c9de83ee210fef661');
 END IF;

end Inser_casUser;

直接定义个类型,
  type td02_table_type is TABLE OF td02%ROWTYPE INDEX BY BINARY_INTEGER;

td02_TABLE td02_table_type;
SELECT B.* BULK COLLECT
            INTO td02_TABLE--东区
            FROM td02 B where b.ytd024 =v_root_id;

原文地址:https://www.cnblogs.com/jifeng/p/1826145.html