Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> using sequence in a trigger

using sequence in a trigger

From: <ccyr6798_at_my-deja.com>
Date: Thu, 21 Oct 1999 22:21:15 GMT
Message-ID: <7uo3kn$ogb$1@nnrp1.deja.com>


I want to use a sequence (met_id_seq) for a unique id (met_id) on a table. I'd like to have an insert trigger take care of that column for me...

create or replace trigger ml_metlab_trg

   before insert or update or delete on ml_metlab

      referencing new as new old as old
      for each row
      begin
         if inserting then
            :new.met_id := met_id_seq.nextval;
         end if;

:
:

But I get an error when creating the trigger. PLS-00357: Table,View Or Sequence reference 'MET_ID_SEQ.NEXTVAL' not allowed in this context

what am I missing?
Thanks,
Cary

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Oct 21 1999 - 17:21:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US