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

Home -> Community -> Usenet -> c.d.o.misc -> Re: WHERE IN query

Re: WHERE IN query

From: Tommy Hagström <tomhag_at_rsv.se>
Date: Wed, 28 Apr 1999 15:32:25 +0200
Message-ID: <Pine.HPX.4.05.9904281529290.21668-100000@u30040.rsv.rsv.se>


On Mon, 26 Apr 1999 tabates_at_my-dejanews.com wrote:

> "Arjan van Bentem" wrote:
> > Timothy wrote
> > > Select * from Table
> > > where ID||Name in (select ID2||Name2 from Table2)
> >
> > Secondly, and by far more important: surely a day comes when someone enters a
> > value for name that starts with a digit. I really think it is bad practice to
> > use such combined keys, unless really needed.
>
> I hadn't anticipated that situation.
> ID Name
> 1 2Timothy
> 12 Timothy
>
> would both match based on my suggestion.
>
> So unless you have controls that prohibit Name from starting with a number,
> I would advise against my initial suggestion.
> Thanks to Arjan for pointing out this potential pitfall.
>
> Timothy
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
>

Or you could simply change

           where ID||Name in (select ID2||Name2 from Table2)

to

           where ID||'-'||Name in (select ID2||'-'||Name2 from Table2)

Tommy

Email: tomhag_at_rsv.se Received on Wed Apr 28 1999 - 08:32:25 CDT

Original text of this message

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