All pastes #916554 Raw Edit

trigger

public text v1 · immutable
#916554 ·published 2008-02-24 19:24 UTC
rendered paste body
CREATE OR REPLACE TRIGGER "calc_salariototal"
BEFORE
UPDATE OR INSERT ON "EMPLEADOS"
FOR EACH ROW
BEGIN
	IF :new.commission_pct is null THEN
		:new.total_salary:=:new.salary;
	ELSE
		:new.total_salary:=:new.salary+(:new.commission_pct*:new.salary);
	END IF;
END "calc_salariototal";
/