title: SQL Trigger WHEN Clause compilation error
body: <p>I am trying to create a trigger that will check that the date entered is in range if the <code>Prog_Type</code> entered is <code>'FILM'</code>, however I receive a compilation error every time the statement is run. </p>
  
  <blockquote>
    <p>The error code is 00103, "Encountered a ; when expected ....."</p>
  </blockquote>
  
  <p>then a list of many punctuation marks. From researching the problem I have seen references to a <code>DECLARE</code> statement, however I am not sure I would need to declare if the <code>Prog_Type</code> is created in the <code>Program_Table</code>, and I have reference that table in the trigger.</p>
  
  <pre><code>CREATE OR REPLACE TRIGGER Prog_Made_Limits
  BEFORE INSERT OR UPDATE OF Prog_Made ON Program_Table
   FOR EACH ROW
    WHEN (NEW.Prog_Type &lt;&gt; 'FILM')
  BEGIN
    IF (:new.Prog_Made &lt; date '1864-12-31' or 
        :new.Prog_Made &gt; sysdate );
    THEN
      RAISE_APPLICATION_ERROR( -20001, 'Program Made date must be later than Dec 31st 1864, and earlier than today, if FILM is inserted');
    END IF;
  END Prog_Made_Limits;
  /
  </code></pre>