Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing two fields 2

Status
Not open for further replies.

jdgonzalez

Programmer
May 11, 2004
72
US
Hi everyone,

I'm a bit new to Oracle so I'm hoping someone can help me out with this. I have two columns that I'm trying to determine if they are correct. The problem is that one field contains a street address and the other contains the street address AND the city state and zip. So the data looks like this:

col a col b
101 main 101 main/anytown usa 12345

How can I check to see if they are the same. My inclination was to have a case statement like:
Code:
(case when col a like 'col b%' then 1 else 0 end) as address_match

When I use the above code it's not returning a match.

I'd appreciate any help.

Thanks
 
Maybe something like:
Code:
SELECT cola, colb
FROM my_table
WHERE INSTR(colb, cola) > 0;
?
 
And if character case is not an issue, you can use this variation of Carp's excellent code:
Code:
SELECT cola, colb
FROM my_table
WHERE INSTR(upper(colb), upper(cola)) > 0;

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 00:17 (22Jul04) UTC (aka "GMT" and "Zulu"), 17:17 (21Jul04) Mountain Time)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top