Re: Generate a unique number in a record
Date: 1997/11/24
Message-ID: <34796536.B8E00947_at_writeme.com>#1/1
P de Raad wrote:
> I've the following problem.
>
> Various user can create a record in a table, The created records are deleted
> after a certain amount of time and written to a history. The only key wich
> can be used is a unique number/sequence. Another table is joined with this
> table and uses this field to join both tables ( this is also the case in the
> history).
>
> I want to know how to create a unique number in one INSERT statement. The
> rowid cannot be used because after the records are deleted the rowid can be
> reused again.
>
> Does anyone have suggestions to solve this problem ?
>
> With kind regards
>
> Gijs Schalk
use a sequence ...
create table mydata ( id number, data long); create sequence mydata_seq minvalue 1 start with 1 increment by 1;
insert into mydata (mydata_seq.nextval, 'blah blah blah );
Klaus Preisler Received on Mon Nov 24 1997 - 00:00:00 CET