Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: creating sequences number

Re: creating sequences number

From: replace this with _at_ <_at_)xs4all.nl>
Date: Thu, 25 Jun 1998 16:34:01 GMT
Message-ID: <3591688a.1240653@news.xs4all.nl>


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?


Received on Thu Jun 25 1998 - 11:34:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US