title: Oracle: auto-increment trigger.
body: <p>Found the following trigger in a database which was blocking inserts on a unique varchar primary key </p>
  
  <pre><code>CREATE OR REPLACE TRIGGER  "BI_PRIVILEGE" 
    before insert on "PRIVILEGE"               
    for each row  
  begin   
    if :NEW."PRIVILEGE-ID" is null then 
      select "PRIVILEGE_SEQ".nextval into :NEW."PRIVILEGE-ID" from dual; 
    end if; 
  end; 
  </code></pre>
  
  <p>Is this an auto-number generator? I can easily disable it to fix my problem, but will there be unforseen negative ramifcations for the primary key?</p>
  
  <p>I have actually been looking for code to set up auto-increment triggers for primary keys and could use this as a template if this is what it is doing. If it is, it is likely doing it incorrectly as the primary key is specifically <code>PRIVILEGE_ID</code> not <code>PRIVILEGE-ID</code>, also, shouldn't some sort of <code>application_error</code> arise in the case of conflicts, etc?</p>