Re: Select enumeration of intergers
Date: 8 Jul 2006 15:58:21 -0700
Message-ID: <1152399501.509279.11420_at_m79g2000cwm.googlegroups.com>
frebe73_at_gmail.com wrote:
> I need to make a select statements according to this:
>
> select value
> from all_integers
> where value => 510 and value < 515
>
> The result should be:
> 510
> 511
> 512
> 513
> 514
>
> Any idea how to define the view "all_integers"? I prefer a solution for
> MySQL, but solution for other vendors would be appreciated too.
>
> I alread tried the solution below but the performance is too bad
>
> create view digits as
> select 0 as digit from dual
> union
> select 1 from dual
> union
> select 2 from dual
> ....
> union
> select 9 from dual
>
> create view all_integers as
> select
> d1.digit + d2.digit*10 + d3.digit*100 + .... + d10.digit*10000000000
> from digits d1, digits d2, digits d3, .... , digits d4
>
> /Fredrik
Hmm, but all those approaches are hacks. Relational operators are only meant to work with relations. Your request is about manipulation of a particular type, hence it's in the domain of stored procedures (type operators). Why can't you just have printNumbers(510,515)? Received on Sun Jul 09 2006 - 00:58:21 CEST