Update Trigger

 


CREATE OR REPLACE TRIGGER "Update_house_TRG" 
BEFORE INSERT OR UPDATE
ON CONSOL_DTL
REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
DECLARE 
MAX_FROMDATE DATE;
MIN_FROMDATE DATE;
BEGIN 
IF INSERTING THEN

FOR x IN (select 
 ROUTING,
 FLIGHT,
 TO_1,
 BY_FIRST_CARRIER_1,
 FLIGHT_NUMBER_1,
 FLIGHT_DATE_1,
 TO_2,
 BY_FIRST_CARRIER_2,
 FLIGHT_NUMBER_2,
 FLIGHT_DATE_2,
 TO_3,
 BY_FIRST_CARRIER_3,
 FLIGHT_NUMBER_3,
 FLIGHT_DATE_3
 FROM consol_mst a,  MAWB B --consol_dtl c
where b.id=a.mawb_id
and a.id = :NEW.CONSOL_MST_ID

)
LOOP

update HAWB_MST SET 
 ROUTING  =x.ROUTING,
 FLIGHT =x.FLIGHT,
 TO_1=x.TO_1,
 BY_FIRST_CARRIER_1=x.BY_FIRST_CARRIER_1,
 FLIGHT_NUMBER_1=x.FLIGHT_NUMBER_1,
 FLIGHT_DATE_1=x.FLIGHT_DATE_1,
 TO_2=x.TO_2,
 BY_FIRST_CARRIER_2=x.BY_FIRST_CARRIER_2,
 FLIGHT_NUMBER_2=x.FLIGHT_NUMBER_2,
 FLIGHT_DATE_2=x.FLIGHT_DATE_2,
 TO_3=x.TO_3,
 BY_FIRST_CARRIER_3=x.BY_FIRST_CARRIER_3,
 FLIGHT_NUMBER_3=x.FLIGHT_NUMBER_3,
 FLIGHT_DATE_3=x.FLIGHT_DATE_3
WHERE id= :NEW.HAWB_MST_ID;

END LOOP;


end if ;
EXCEPTION
     WHEN OTHERS THEN
       RAISE;
END;

Note : This Trigger Set on Database

when "Shipment Consolidation" Form save then update "MAWB" wise "HAWB" Column




Post a Comment

Previous Post Next Post