Error during trigger execution -ORA-04088？
<p>The trigger will work if the update value is out of range of the employee's salary.</p>

<p>Here is my trigger code:</p>

<pre><code>CREATE OR REPLACE TRIGGER check_sal_range_12483
  BEFORE UPDATE OF min_salary, max_salary ON cux_jobs_12483
  FOR EACH ROW
DECLARE
  v_num NUMBER;
BEGIN

  SELECT e.employee_id
    INTO v_num
    FROM cux_employees_12483 e
   WHERE e.job_id = 'SA_MAN'
     AND e.salary NOT BETWEEN :NEW.min_salary AND :NEW.max_salary;

  IF SQL%ROWCOUNT &gt;= 1 THEN
    raise_application_error(-20901, 'Salary out of range!');
  END IF;

EXCEPTION
  WHEN no_data_found THEN
    dbms_output.put_line(SQLCODE || SQLERRM);
  WHEN too_many_rows THEN
    dbms_output.put_line(SQLCODE || SQLERRM);
  WHEN OTHERS THEN
    dbms_output.put_line(SQLCODE || SQLERRM);
    raise_application_error(-20901, 'Salary out of range!');
END;
</code></pre>

<p>And here is the call:</p>

<pre><code>BEGIN
  UPDATE cux_jobs_12483
     SET min_salary = 500, max_salary = 10000
   WHERE job_id = 'SA_MAN';
EXCEPTION
  WHEN OTHERS THEN
    dbms_output.put_line(SQLCODE || SQLERRM);
END;
</code></pre>

<p>The error code is:</p>

<pre><code>-20901ORA-20901: Salary out of range!
ORA-06512: at "CHECK_SAL_RANGE_12483", line 12
ORA-04088: error during execution of trigger 'CHECK_SAL_RANGE_12483'
</code></pre>

<p>If i don't add raise_application_error in the EXCEPTION of trigger, the update will success and trigger dosen't work.</p>