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

From: Date: Thu, 30 May 2002 15:23:19 +0000
Subject: Re: Re: SQL question, getting error and not sure why
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-99947@lists.php.net to get a copy of this message
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 (#99947) next »