Re: Re: SQL question, getting error and not sure why

From: Date: Thu, 30 May 2002 19:13:26 +0000
Subject: Re: Re: SQL question, getting error and not sure why
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-99987@lists.php.net to get a copy of this message
yes, in that way the query i suggested would look like: insert into acteursenc (nomacteur) values ('Michael Sweeney') and nuacteur would be provided by the before insert trigger automatically. that's like mysqls autoincrement. Michael "Rouvas Stathis" <rouvas@di.uoa.gr> schrieb im Newsbeitrag news:3CF643E7.3520F45@di.uoa.gr... > I would use a trigger with a sequence, as in: > > CREATE SEQUENCE <sequence_name>_SEQ > INCREMENT BY 1 > START WITH -99999999999999999999999999 > MAXVALUE 9999999999999999999999999999999999999999999999 > MINVALUE -999999999999999999999999999999999999999999999 > CYCLE CACHE 5 ORDER; > > create or replace trigger <trigger_name>_autonum_ins > before insert on <table_name> > for each row > begin > if :new.<field1> is null then > select <sequence_name>_seq.nextval into :new.<field1> from dual; > end if; > end; > > -Stathis. > > Michael Sweeney wrote: > > > > lol sorry, buttons are too close together in OE. > > > > Anyon ehave a sugestion on a different way of doing what I want to do? > > Should be easy but i;m starting to get a headache from this (6-7 years not > > doing SQL doesn't help either) > > > > -- > Rouvas Stathis > rouvas@di.uoa.gr > http://www.di.uoa.gr/~rouvas

« previous php.general (#99987) next »