Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Select enumeration of intergers

Re: Select enumeration of intergers

From: Cimode <cimode_at_hotmail.com>
Date: 10 Jul 2006 02:34:37 -0700
Message-ID: <1152524077.476931.307310@35g2000cwc.googlegroups.com>

Alvin Ryder wrote:
> 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)?
I would not put it that way. The fact to extract values directly from domain of values without having some data type regulating that extraction it self is a hack in relational perspective. As a consequence, this kind of need is a consequence of SQL DBMS failing to implement correctly RM rules and definitions. Received on Mon Jul 10 2006 - 04:34:37 CDT

Original text of this message

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