Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Adding a Sequence to an existing table
add the sequence column (alter table...)
update Table set sequence_column = rownum -- populate existing rows /
select max(sequence_column) from Table -- find max /
create sequence seq_T start with MAX_FROM_ABOVE+1 /
create trigger on Table
for each row
before insert
begin
select seq_T.nextval into :new.sequence_column from dual;
end;
/
to populate
"Paul" <paul_merlin_at_hotmail.com> wrote in message
news:bf31b525.0107160416.7c6b5f3c_at_posting.google.com...
> Hi,
>
> I need to add a sequence column to a table that currently has approx
> 3000 rows.
> I cannot change the name of the table as it is used by a number of
> different applications.
>
> Can anybody offer any advice.
>
> Thanks,
>
> Paul
Received on Mon Jul 16 2001 - 18:43:53 CDT