title: PL/SQL DB triggers - Make insertion fail if a given condition is not met
body: <p>I have a small test database I'm using for learning SQL.<br>
  There's a <code>Duel</code> table, which contains two <code>Pilot</code> foreign keys (the duelists). I want to check if the duelists haven't already "met" before insertion.</p>
  
  <p>Pseudocode:</p>
  
  <pre><code>before insertion on Duel
  for each row already in the table
    if ((new_row.numpilot1 = old_row.numpilot1 and new_row.numpilot2 = old_row.numpilot2) OR
        (new_row.numpilot1 = old_row.numpilot2 and new_row.numpilot2 = old_row.numpilot1)
       )
      insertion fails
  </code></pre>
  
  <p>One other alternative would be</p>
  
  <pre><code>tempnum integer;
  select numpilot1 into tempnum from duel 
  where (:NEW.numpilot1 = numpilot1 and :NEW.numpilot2 = numpilot2) OR
        (:NEW.numpilot1 = numpilot2 and :NEW.numpilot2 = numpilot1);
  
  if tempnum == null
      fail insertion
  </code></pre>
  
  <p>What is the PL/SQL (Oracle DBMS) version of this?</p>