Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: creating sequences number
On 24 Jun 1998 14:32:56 GMT, lien_at_cs.umb.edu (j.k.) wrote:
>I have to create sequences number by using PL/SQL after
>the table has been created and insert all of vaules into the table.
>
>The sequence number increament by 1 start with 1000 NOCYCLE NOCACHE ORDER.
>
>Do anyone can provide me some reference of PL/SQL programs. thank you.
Why use a PL/SQL program when the following will do?
( create sequence mysequence start with 1000; )
update table set mynumber = mysequence.nextval;
But ok, with PL/SQL you can do the following:
declare
cursor cMyTable is
select mynumber
from mytable
for update of mynumber;
begin
for rMyTable in cMyTable loop
update cMyTable
set mynumber = mysequence.nextval
where current of cMyTable;
end loop;
end;
Will this do?
![]() |
![]() |