RE: Sequences
Posted in 2005
Scottishpoet wrote
> according to the SQL syntax Guide "Authorized users of a
> sequence can request a new value by including the
> sequence.NEXTBAL expression in SQL statement"
>
> http://publibfp.boulder.ibm.com/epubs/pdf/ct1sqna.under
> "create sequence" (2-207)
>
> so, I tried :
> insert into tab1 ( tab1_id, descript )
> values (tab1_seq.nextval,"first" );>
> insert into tab1 ( tab1_id, descript )
> values (tab1_seq.nextval,"second" );
Thanks, that seems to work fine. Now I just have to work out how to get
this code change through the system. :-(
And Claus Samuelsen wrote
>create function myval()
> returning integer;> return (select myseq.nextval from systables where tabid=1); end
function;
>create trigger mytrig insert on mytab
> referencing new as post
> for each row when (post.tid is null)
> (execute function myval() into tid);
That works splendidly. I have just got to work out if there is much of a
performance hit when
calling a trigger and function a few thousand times a minute .
>
> > I would like to run sql -
> > insert into tab1 ( descript ) values ("first record" )> >
Colin Bull
_______________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email
Security System.
_______________________________________________________________________
sending to informix-list