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: PL/SQL help

Re: PL/SQL help

From: JonWat <jonwaterhouse_at_gov.nl.ca>
Date: 28 Sep 2006 10:55:46 -0700
Message-ID: <1159466145.961703.122370@i3g2000cwc.googlegroups.com>

RJ wrote:
> Hi all,
>
> I have the follwoing table (abc):
>
> NAME NO_CASES
> --------- -------------------
>
> Smith 13
> John 9
> Mary 5
> Kate 23
>
> I want to insert into another table (xyz) as follows:
>
> Smith must be inserted 13 times (13 rows), John 9 times (9 rows) etc..
> for all the records in the table.
>
> How will I do this?
>
> Thanks in advance...

You can do this on a single row.

( select name

        from t
      connect by level <=  no_case );

Won't work on multiple rows, though, so you might have to put it in a cursor loop. Not sure if there is a way to do it directly in a single query. Received on Thu Sep 28 2006 - 12:55:46 CDT

Original text of this message

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