1 CREATE OR REPLACE TriggerTrig_solr_index_el_lesson2AfterUpdate ofLessonid, Lessonname, lessongoal, note, TeacherName, Teacherid, Classidname, ClassID, Crtime, statusOr Delete or Insert onEl_lesson3 forEach Row4 Declare5 --Local Variables here6New_status Number;7 begin8New_status:=: New.status;9 ifInserting ThenTen begin One INSERT intoSolr_index A (ID, docid, type) - VALUES -(Solr_index_seq. Nextval,: New.lessonid,'Add'); the End; - End if; - - ifUpdating Then + --contrast the old state and the new state - ifNew_status= -1 and: Old.status!= -1 Then + A INSERT intoSolr_index at (ID, docid, type) - VALUES -(Solr_index_seq. Nextval,: Old.lessonid,'Delete'); - - Else - INSERT intoSolr_index in (ID, docid, type) - VALUES to(Solr_index_seq. Nextval,: Old.lessonid,'Update'); + - End if; the End if; * $ ifdeleting ThenPanax Notoginseng begin - INSERT intoSolr_index the (ID, docid, type) + VALUES A(Solr_index_seq. Nextval,: Old.lessonid,'Delete'); the End; + End if; - End;
Oracle Trigger--if Else Demo