eg1:
create or replace trigger SYM_U_BS_STUDENT after update on BASE_STUDENT for each row
begin
if (:new.EVENT_SOURCE=0) or (:new.EVENT_SOURCE is null) then
insert into sym_STUDENT (event_type,sym_id,id,school_id,class_id,student_name,old_name,student_code,unitive_code,identity_card,sex,birthday,mobile_phone,is_leave_school,enroll_year,class_inner_code,economy_state,card_number,is_singleton,stayin,boorish,is_local_source,student_recruitment,study_mode,native_place,homepage,email,link_phone,link_address,postalcode,region_code,creation_time,modify_time,is_deleted,event_source,is_freshman,password,now_state,school_district,meetexam_code,source_place,is_specialid,dir_id,file_path,health,nation,background,polity_join_date,home_address,to_school_date,dorm,dorm_tel,spec_id,specpoint_id,enter_score)
values(decode(:new.is_deleted,1,'D',0,'U'),sys_guid(),:new.id,:new.school_id,:new.class_id,:new.student_name,
:new.old_name,:new.student_code,:new.unitive_code,:new.identity_card,:new.sex,:new.birthday,:new.mobile_phone,
:new.is_leave_school,:new.enroll_year,:new.class_inner_code,:new.economy_state,:new.card_number,:new.is_singleton,:new.stayin,:new.boorish,:new.is_local_source,:new.student_recruitment,:new.study_mode,:new.native_place,
:new.homepage,:new.email,:new.link_phone,:new.link_address,:new.postalcode,:new.region_code,:new.creation_time,
:new.modify_time,:new.is_deleted,:new.event_source,:new.is_freshman,:new.password,:new.now_state,
:new.school_district,:new.meetexam_code,:new.source_place,:new.is_specialid,:new.dir_id,:new.file_path,
:new.health,:new.nation,:new.background,:new.polity_join_date,:new.home_address,:new.to_school_date,:new.dorm,:new.dorm_tel,:new.spec_id,:new.specpoint_id,:new.enter_score);
end if;
end;
eg2:
create or replace trigger tr_u_student after update on base_student for each row
begin
if(:new.student_name <> :old.student_name or :new.sex <> :old.sex or :old.sex is null
or :new.class_id <> :old.class_id or :old.class_id is null or :new.mobile_phone <> :old.mobile_phone
or :old.mobile_phone is null
or :new.birthday <> :old.birthday or :old.birthday is null or :new.school_id <> :old.school_id ) then
update base_user set real_name=:new.student_name,sex=:new.sex,class_id=:new.class_id,
mobile_phone=:new.mobile_phone,birthday=:new.birthday,unit_id=:new.school_id,event_source=0,
modify_time=sysdate where owner_id=:new.id;
end if;
end;
eg3: