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: SQL programming quesion

Re: SQL programming quesion

From: Andrey Roslyakov <andrey-roslyakov_at_worldnet.att.net>
Date: Wed, 11 Aug 1999 00:32:10 -0400
Message-ID: <37B0FCCA.2E0F26C5@worldnet.att.net>


create or replace procedure sp_x_inserts as
cursor get_x
is select * from the_table where x_col>1; x number:=0;
begin
  for cur_rec in get_x loop

       for x in 1..cur_rec.x_col loop
           insert into ......
      end loop;

  end loop;
end sp_x_inserts;

Andre.
julie15ann_at_my-deja.com wrote:

> What logic do you use when you have a column that
> says there are X items and I want to insert the
> information on those X items into another table.
> If I did it in another programming language I
> would program it as follows:
>
> If "X items" > 1 Then
> {
> For i = 1 to "X items"
> {
> Insert A
> }
> }
>
> What I need to do is find all the columns of this
> table where X is greater than 1 and when I find
> those coulumns I would like to insert the
> information from that record X number of times
> into another table. How can I do the above using
> SQL? If you respond to this post could you also
> please reply to my email address at
> julie15ann_at_aol.com
>
> Thanks
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Received on Tue Aug 10 1999 - 23:32:10 CDT

Original text of this message

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