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
[EMAIL PROTECTED]
http://www.di.uoa.gr/~rouvas

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to