User Tools

Site Tools


kurs:default_value_trigger
CREATE OR REPLACE TRIGGER check_salary
 BEFORE
  UPDATE
 ON emp_bonus
REFERENCING NEW AS NEW OLD AS OLD
 FOR EACH ROW
declare
  v_min_salary number(30);
  v_max_salary number(30);
begin

if :new.salary=0  then
  SELECT jobs.min_salary, jobs.max_salary
    into
    v_min_salary, v_max_salary
  FROM employees, jobs
    WHERE ((jobs.job_id = employees.job_id)
  AND (employees.employee_id = :new.emp_id));
  :new.salary := (v_min_salary+v_max_salary)/2;
end if;
    
end;
/
kurs/default_value_trigger.txt · Last modified: 2014/09/10 21:22 (external edit)