Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2002
    Posts
    9

    Question Unanswered: (ObjKommun IN ('xxxx%', 'oooo%'))

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

    Thx in advance!

  2. #2
    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

  3. #3
    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

  4. #4
    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

  5. #5
    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.

  6. #6
    Join Date
    Jul 2001
    Location
    Germany
    Posts
    189
    That´s it

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •