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

Home -> Community -> Usenet -> c.d.o.server -> Re: can wild cards be used in BETWEEN clause

Re: can wild cards be used in BETWEEN clause

From: Joel Garry <joel-garry_at_home.com>
Date: 13 Apr 2004 14:20:12 -0700
Message-ID: <91884734.0404131320.54fe078d@posting.google.com>


Brian Peasland <dba_at_remove_spam.peasland.com> wrote in message news:<407C2497.AFD57CD8_at_remove_spam.peasland.com>...
> SAL wrote:
> >
> > Hi,
> > I am trying to select names of all countries from a column:
> > SELECT country FROM countries_table
> > WHERE
> > country BETWEEN 'A%' AND 'Z%';
> >
> > This gives me every name except those starting with Z. I wonder if this is
> > the right approach.
> > Any help will be appreciated.
> >
> > Thanks.
>
> But why use wildcards? Wouldn't the following query return the same
> thing without wildcards?
>
> SELECT country FROM countries_table
> WHERE country BETWEEN 'A' and 'ZZZ';
>
> No wild cards needed. Especially on the first end point. If you use 'A%'
> then it seems to me that you want to say everything that starts with 'A'
> and contains any number of letters (even zero) in any combination after
> that. Isn't that what 'A' does by itself without wildcards?

I'm still dealing with odd code that makes 'A ' different than 'A'. Sometimes. sigh. Point is, always be explicit about what you want, even if the language defaults to the correct behavior.

jg

--
@home.com is bogus.  Hey, I know!  Let's play the usenet name-flameout
game!  Every time you see someone's name mispelled, have a shot of
whiskey.  If you see your own name, have two!  If your given and
surname are misordered, have three! If you mispell your _own_ name,
slam a brew!
Received on Tue Apr 13 2004 - 16:20:12 CDT

Original text of this message

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