Re: SEQUENCE in a TRIGGER

From: Kjartan R Gudmundsson <kjartang_at_ejs.is>
Date: 1996/02/26
Message-ID: <4gs28i$rde_at_njala.saga.is>#1/1


nathalie_at_MAIL.ATCON.COM (Nathalie) wrote:

>I created a SEQUENCE:
 

>CREATE SEQUENCE NEXT_KEY_GEN INCREMENT BY 1 START BY 1;

>and then a TRIGGER for my table TRANSACTION:
 

>CREATE TRIGGER TRIG_NEXT_KEY_TRANSACTION
> BEFORE INSERT ON TRANSACTION
> FOR EACH ROW
>BEGIN
> :NEW.P_KEY := next_key_gen.nextval;
>END;
PL/SQL does not allow this use for nextval (at least 2.0 does not) but "select next_key_gen.nextval into :NEW.P_KEY from dual;" should work. Received on Mon Feb 26 1996 - 00:00:00 CET

Original text of this message