Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2003
    Location
    ny
    Posts
    23

    Unanswered: string a to match to string b

    Hello, how to find data in one table based on another string from another table?
    Only one thing.
    Data in one table can have a first or last digit missing.

    string a to match string b

    a = '01234567899'
    b = '123456789'

    How to do the match?

    Thanks a lot.

  2. #2
    Join Date
    Jan 2004
    Location
    North Haven, CT
    Posts
    110

    Re: string a to match to string b

    Originally posted by oranewbee
    Hello, how to find data in one table based on another string from another table?
    Only one thing.
    Data in one table can have a first or last digit missing.

    string a to match string b

    a = '01234567899'
    b = '123456789'

    How to do the match?

    Thanks a lot.
    where b in (a,substr(a,1,length(:a)-1),substr(a,2,length(:a)),substr(a,2,length(:a) - 2))

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    use INSTR function

  4. #4
    Join Date
    Oct 2003
    Location
    ny
    Posts
    23

    Re: string a to match to string b

    Originally posted by lynden.zhang
    where b in (a,substr(a,1,length(:a)-1),substr(a,2,length(:a)),substr(a,2,length(:a) - 2))

    I'm new to oracle , what is an (:a)

    thank you

  5. #5
    Join Date
    Jan 2004
    Location
    North Haven, CT
    Posts
    110

    Re: string a to match to string b

    Originally posted by oranewbee
    I'm new to oracle , what is an (:a)

    thank you
    just ignore it. I forgot to remove them. it means bind variable.
    instr is easier, just make sure length is off 1 or 2.

  6. #6
    Join Date
    Jan 2004
    Location
    North Haven, CT
    Posts
    110

    Re: string a to match to string b

    Originally posted by lynden.zhang
    just ignore it. I forgot to remove them. it means bind variable.
    instr is easier, just make sure length is off 1 or 2.
    if you want to use instr:

    instr(a,b) > 0
    and length(a) - length(b) < 3

  7. #7
    Join Date
    Oct 2003
    Location
    ny
    Posts
    23

    Re: string a to match to string b

    Originally posted by lynden.zhang
    if you want to use instr:

    instr(a,b) > 0
    and length(a) - length(b) < 3
    thank you

Posting Permissions

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