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: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 28 Sep 2006 09:18:32 -0700
Message-ID: <1159460312.866743@bubbleator.drizzle.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...

The first think you do is the following query:

SELECT keyword
FROM gv$reserved_words
WHERE keyword LIKE 'nam%';

and rename your column.

Then you write an anonymous block or stored procedure that selects the number of cases from your table and performs inserts in a FOR loop.

-- 
Daniel Morgan
University of Washington
Puget Sound Oracle Users Group
Received on Thu Sep 28 2006 - 11:18:32 CDT

Original text of this message

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