If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > (ObjKommun IN ('xxxx%', 'oooo%'))

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-19-02, 05:20
Scre@m Scre@m is offline
Registered User
 
Join Date: Feb 2002
Posts: 9
Question (ObjKommun IN ('xxxx%', 'oooo%'))

My question, is it valid to use "IN" as in "LIKE" conserning strings? (Using the "%" operator)

Thx in advance!
Reply With Quote
  #2 (permalink)  
Old 03-19-02, 05:47
alligatorsql.com alligatorsql.com is offline
Registered User
 
Join Date: Jul 2001
Location: Germany
Posts: 189
Hello,

you canīt you % in this way (for Oracle). Use SUBSTR(var, start, length)

Hope this helps ?

Greetz

Manfred Peter
(Alligator Company)
http://www.alligatorsql.de
Reply With Quote
  #3 (permalink)  
Old 03-19-02, 05:58
Scre@m Scre@m is offline
Registered User
 
Join Date: Feb 2002
Posts: 9
This is just a short copy of a SP im using in SQL server... now the problem appears if there will be to many parameters involved.. (HUGE query)

My main problem is how to reduce the length of the query..

So, instead of doing it like this..:

AND (((xxxx like 'yyyy%') OR (xxxx like 'zzzz%')))

I was thinking of doing like this..:

xxxx IN ('yyyy%', 'zzzz%')


But when im using the "IN" im not able to use the % (Cause sometimes strings are weird) and no result is shown, but when removing the % i get the satisfying result, not depending on Case sensitivity which is perfect, but still...

And im really really lousy to explain things, hope its ok anyways
Reply With Quote
  #4 (permalink)  
Old 03-19-02, 07:39
MattR MattR is offline
Registered User
 
Join Date: Mar 2001
Location: Lexington, KY
Posts: 606
No, IN cannot be used as a substitute for 'like', it will not work. You could try looking at applying a string function on the column side, e.g. WHERE substring( mycolumn, 0, 4) IN ( 'stri', '1234', 'etc.' )
__________________
Thanks,

Matt
Reply With Quote
  #5 (permalink)  
Old 03-19-02, 07:54
Scre@m Scre@m is offline
Registered User
 
Join Date: Feb 2002
Posts: 9
Okay, thx for the response.

Think I will use "IN" but forget about trying to make it work like "LIKE"

Most important is that the length of the query is shortened.

Best wishes from Sweden.
Reply With Quote
  #6 (permalink)  
Old 03-19-02, 07:55
alligatorsql.com alligatorsql.com is offline
Registered User
 
Join Date: Jul 2001
Location: Germany
Posts: 189
Thatīs it

Greetings
Manfred Peter
(Alligator Company)
http://www.alligatorsql.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On