Re: generate number of rows form a column value
Date: Wed, 15 Apr 2009 19:02:57 +0200
Michael Austin schrieb:
> newhorizon wrote:
>> create table test_table ( isim varchar2(50), cnt number); >> insert into test_table values ('John', 1) ; >> insert into test_table values ('Dave', 2) ; >> insert into test_table values ('Simit', 3) ; >> insert into test_table values ('TEST', 0) ; >> >> >> How can I generate an output like the following : >> >> >> John 1 >> Dave 2 >> Dave 2 >> Simit 3 >> Simit 3 >> Simit 3 >> >> Release of ora10gR2 >>
> just curious, but, why would you want to duplicate your data? What
> happens when that number is 100? 1000? 100000000?
> Sounds like a job for PL/SQL -
> select data into cursor
> parse data
> display/output required results.
> goto next value
> Most database applications want to limit the number of "duplicates"
> rather than creating duplicates...
Well, i could imagine a real scenario for such application in a
datawarehouse (well known for denormalized data) - isim can stand for
product name and cnt - for number of months (weeks, days) (with missing
data). Then, often used technique is filling the gaps ( like in oracle
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/analysis.htm#CIHIGEDA (Filling Gaps in an Inventory Table example)
Maxim Received on Wed Apr 15 2009 - 12:02:57 CDT