title: pl/sql trigger alter sequence
body: <p>I'm really new to pl/sql. I'm trying to do a Trigger like this one (adr = after delete row) but it seems that I can't use ALTER SEQUENCE. Is this the right way of decrementing after a row is deleted or should I use a procedure?</p>
  
  <pre><code>CREATE OR REPLACE TRIGGER adr_trg
  AFTER DELETE ON table
  FOR EACH ROW
  BEGIN
  ALTER SEQUENCE table_seq INCREMENT BY -1;
  END;
  </code></pre>
  
  <p>Edit: </p>
  
  <p>Sequence I'm using:</p>
  
  <pre><code>CREATE SEQUENCE table_seq INCREMENT BY 1 START WITH 1;
  </code></pre>
  
  <p>Trigger I'm using:</p>
  
  <pre><code>CREATE OR REPLACE TRIGGER bir_trg
     BEFORE INSERT ON table
     FOR EACH ROW
  BEGIN
     IF :new.id IS NULL
     THEN
        :new.id := table_seq.nextval;
     END IF;
  END bir_trg;
  </code></pre>