Re: sequences in 7.1
Date: 1995/06/07
Message-ID: <3r4ldh$55e_at_alva.ge.com>#1/1
Stefan Richter writes
> > In article <fiechtl.23.001758D6_at_genesis.westend.com>,
> > fiechtl_at_genesis.westend.com says...
> >
> > Hi everybody,
> > ...
> > create or replace trigger count before insert
> > on test
> > begin
> > :new.lfdnr := counter.NEXTVAL;
> > end;
> > -----------------------------------------------
> > Hmm, the problem seems to be not so difficult. But maybe i stupid.
> > Reinhard Fiechtl
>
> You can use currval or nextval only in a SELECT list, the VALUES clause,
> and the SET clause.
>
> So, much more easy:
>
> INSERT INTO test (lfdnr, ...)
> VALUES (counter.NEXTVAL, ...)
> Stefan
You can also use a select statement to assign values from a sequence. For example:
create or replace trigger count before insert
on test
begin
select counter.NEXTVAL into :new.lfdnf from dual; end;
Hope this helps
Mark
-- Mark Ritchie - Object Oriented Developer GE Capital Technology Services Mississauga, Ontario, Canada mark_at_susie.gets.ge.com [NeXTmail and MIME]Received on Wed Jun 07 1995 - 00:00:00 CEST