title: Oracle Trigger: raise_application_error
body: <p>I want to use the raise_application_error-procedure to stop the login process.
  I wrote a trigger, that checks the TERMINAL String, if it is right (I know that isn't realy secure, but at first, it is enough)
  So the Trigger works fine and does what i want, but the raise_application_error causes an rollback and sends not the exception that I want. Whenn I log into the DB with my Application, the raise_application_error doesnt stop the app.
  First question: Is this the right way, to stop logon the db with the wrong application?
  Second question: If yes, what is wrong?</p>
  
  <pre><code>create or replace
  TRIGGER after_logon_on_database 
  AFTER LOGON ON DATABASE
  BEGIN
  IF sys_context('USERENV', 'TERMINAL')='IAS' THEN
    INSERT INTO event_log
    (event_date, event_time, username, event_case, event_comment)
    VALUES
    (SYSDATE, to_char(sysdate, 'hh24:mi:ss'), USER, 'LOGON-SUCCESS', sys_context('USERENV', 'TERMINAL'));
  ELSE
    INSERT INTO event_log
    (event_date, event_time, username, event_case, event_comment)
    VALUES
    (SYSDATE, to_char(sysdate, 'hh24:mi:ss'), USER, 'LOGON-FAILURE', sys_context('USERENV', 'TERMINAL'));
    RAISE_APPLICATION_ERROR(-20001, 'Access denied!');
  END IF;
  END after_logon_on_database;
  </code></pre>