Re: generate number of rows form a column value
From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Wed, 15 Apr 2009 19:02:57 +0200
Message-ID: <49E61341.3040102_at_gmail.com>
Michael Austin schrieb:
> newhorizon wrote:
>
> 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...
Date: Wed, 15 Apr 2009 19:02:57 +0200
Message-ID: <49E61341.3040102_at_gmail.com>
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
warehousing quide)
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/analysis.htm#CIHIGEDA
(Filling Gaps in an Inventory Table example)
Best regards
Maxim Received on Wed Apr 15 2009 - 12:02:57 CDT