Re: Sequence Question

From: Michel Lalonde <michel.lalonde_at_sit.ulaval.ca>
Date: 1996/09/11
Message-ID: <michel.lalonde.86.00096A88_at_sit.ulaval.ca>#1/1


In article <3235CF28.1926_at_adaptron.com> David J Roth <droth_at_adaptron.com> writes:
>From: David J Roth <droth_at_adaptron.com>
>Subject: Sequence Question
>Date: Tue, 10 Sep 1996 16:27:20 -0400
 

>I need to set up a table so that a unique key gets populated automatically.
>It would be nice if I could use a sequence in a default declaration but this is not allowed.
>I thought I could use a sequence in a trigger but this does not seem to work either.
 

>I would appreciate any suggestions for other approaches.
 

>Dave Roth

Try SELECT MY_SEQUENCE.NEXTVAL INTO :NEW.UNIQUE_KEY FROM DUAL; in the before insert trigger. It works fine.

Michel Lalonde Received on Wed Sep 11 1996 - 00:00:00 CEST

Original text of this message