Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2010
    Posts
    64

    Unanswered: unlike & like in oracle

    Hi,

    I have 2 columns in my table cola and colb and both are varchar.

    i have write a condition such that the data in cola is present as substring in colb but i dont know about the starting and ending position of the substring.

    select * from temp a where a.cola like a.colb; is not working for me.

    i tried putting % ->
    select * from temp a where a.cola like '%a.colb%';

    Sample data :-

    cola colb
    Underwood D T Underwood D
    Underwood D T & P UNDERWOOD


    please advise !!

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Code:
    WHERE a.cola LIKE '%' || a.colb || '%'

  3. #3
    Join Date
    Jan 2010
    Posts
    64

    it didn't work for me, i am not getting the desired output.

    it didn't work for me, i am not getting the desired output.

  4. #4
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    "didn't work" is not enough

    - show us the structure of your table as CREATE TABLE statement
    - show us some sample data as INSERT INTO statements

    Then it will be a lot easier for us to reproduce your problem

    Edit:

    on second thought: it's probably a matter of uppercase vs. lowercase, so try
    Code:
    WHERE lower(a.cola) LIKE '%' || lower(a.colb) || '%'
    Last edited by shammat; 11-25-10 at 05:59.

  5. #5
    Join Date
    Jan 2010
    Posts
    64

    thanks! shammat

    Thanks! shammat

    Your second was right on target , it was not working because of the case.

    Thank you very much !!!

Posting Permissions

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