title: Oracle SQL Trigger partially not working
body: <p>I am writing a database script for an assignment. I have a trigger that I want to create employment history from updates on Employees table. It works for changing the salary, but does not when changing job_title, to either <code>null</code> of different value.</p>
  
  <pre><code>create or replace trigger employment_update
  after update on employees for each row
  begin 
  if :old.salary &lt;&gt; :new.salary then
  insert into employment_history values (empl_hist_seq.nextval,sysdate,'zmiana_wynagrodzenia',:new.employee_id);
  end if;
  if :new.job_title = null then
  insert into employment_history values (empl_hist_seq.nextval,sysdate,'zwolnienie',:new.employee_id);
  elsif :old.job_title &lt;&gt; :new.job_title then
  insert into employment_history values (empl_hist_seq.nextval,sysdate,'zmiana_stanowiska',:new.employee_id);
  end if;
  end;
  /
  </code></pre>
  
  <p>Testing:</p>
  
  <pre><code>update employees set job_title = null where employee_id = 2;
  update employees set job_title = 'test' where employee_id = 2;
  update employees set salary = 1500 where employee_id = 4;
  select * from EMPLOYMENT_HISTORY;
  show errors;
  ................................................................................
  
  1 row updated.
  1 row updated.
  1 row updated.
  
  HISTORY_ID CHANGE_DATE CHANGE_TYPE                      EMPLOYEE_ID
  ---------- ----------- -------------------------------- -----------
       0 15/11/26    zatrudnienie                               0
       1 15/11/26    zatrudnienie                               1
       2 15/11/26    zatrudnienie                               2
       3 15/11/26    zatrudnienie                               3
       4 15/11/26    zatrudnienie                               4
       5 15/11/26    zatrudnienie                               5
       6 15/11/26    zatrudnienie                               6
       7 15/11/26    zatrudnienie                               7
       8 15/11/26    zatrudnienie                               8
       9 15/11/26    zatrudnienie                               9
      10 15/11/26    zmiana_wynagrodzenia                       4
  
  11 rows selected 
  
  No errors.
  </code></pre>
  
  <p>Tables: </p>
  
  <p>employees</p>
  
  <pre><code>create table employees
  (
  employee_id number(5) primary key,
  first_name varchar2(16) not null,
  last_name varchar2(32) not null,
  job_title varchar2(32),
  salary  number(8,2),
  address_id number(5) references addresses(address_id) not null
  );
  </code></pre>
  
  <p>employment_history + sequence </p>
  
  <pre><code> create sequence empl_hist_seq
  increment by 1
  minvalue 0
  maxvalue 99999
  nocycle
  nocache;
  
  create table employment_history
  (
  history_id number(5) primary key,
  change_date date not null,
  change_type varchar2(32) not null,
  employee_id number(3) references employees(employee_id) not null
  );
  </code></pre>