![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a situation where I'm trying to compare information in two different columns in a where clause. The information in question are last names. In column 1, the information is stored in mixed case. So it might contain Jones Smith O'Malley In column 2, the name was entered via software which caused the letters to be upper case, and did not permit entry of special characters like the apostrophe. So its corresponding values would be JONES SMITH O MALLEY The where expression I am trying to get to work is (upper(table1.last_name,'''','_') not like table2.last_name) (this is just one part of a more complicated condition statement) This produces nearly the results I want - except for that pesky apostrophe. So I tried (upper(replace(table1.last_name,'''','_')) not like table2.last_name) but I do not see any difference in the items returned. Is there some other techniques needed for this type of thing? |
#3
| |||
| |||
|
|
I have a situation where I'm trying to compare information in two different columns in a where clause. The information in question are last names. In column 1, the information is stored in mixed case. So it might contain Jones Smith O'Malley In column 2, the name was entered via software which caused the letters to be upper case, and did not permit entry of special characters like the apostrophe. So its corresponding values would be JONES SMITH O MALLEY The where expression I am trying to get to work is (upper(table1.last_name,'''','_') not like table2.last_name) (this is just one part of a more complicated condition statement) This produces nearly the results I want - except for that pesky apostrophe. So I tried (upper(replace(table1.last_name,'''','_')) not like table2.last_name) but I do not see any difference in the items returned. Is there some other techniques needed for this type of thing? |
#4
| |||
| |||
|
|
On Mar 27, 8:42*am, "Larry W. Virden" <lvir... (AT) gmail (DOT) com> wrote: I have a situation where I'm trying to compare information in two different columns in a where clause. The information in question are last names. In column 1, the information is stored in mixed case. So it might contain Jones Smith O'Malley In column 2, the name was entered via software which caused the letters to be upper case, and did not permit entry of special characters like the apostrophe. So its corresponding values would be JONES SMITH O MALLEY The where expression I am trying to get to work is (upper(table1.last_name,'''','_') not like table2.last_name) (this is just one part of a more complicated condition statement) This produces nearly the results I want - except for that pesky apostrophe. So I tried (upper(replace(table1.last_name,'''','_')) not like table2.last_name) but I do not see any difference in the items returned. Is there some other techniques needed for this type of thing? What version of Oracle? On 10g plus you have the regular expression functions that could be used. *These functions have a case insensitive option. On all versions you have the replace function which could be used to remove the pesky apostrophe from the one column. HTH -- Mark D Powell --- Hide quoted text - - Show quoted text - |
#5
| |||
| |||
|
|
I have a situation where I'm trying to compare information in two different columns in a where clause. The information in question are last names. |
|
The where expression I am trying to get to work is (upper(table1.last_name,'''','_') not like table2.last_name) |
|
Is there some other techniques needed for this type of thing? |
#6
| |||
| |||
|
|
The where expression I am trying to get to work is (upper(table1.last_name,'''','_') not like table2.last_name) |
#7
| |||
| |||
|
|
On Mar 27, 7:42*am, "Larry W. Virden" <lvir... (AT) gmail (DOT) com> wrote: So I tried ( (upper(table1.last_name,'''','_') not like table2.last_name)not like table2.last_name) but I do not see any difference in the items returned. Is there some other techniques needed for this type of thing? Are you replacing apostrophe ' *with underscore _ ? |
|
And since you really are going one for one, the TRANSLATE function might work as well (or as poorly). |
#8
| |||
| |||
|
|
On Mar 27, 8:42*am, "Larry W. Virden" <lvir... (AT) gmail (DOT) com> wrote: I have a situation where I'm trying to compare information in two different columns in a where clause. The information in question are last names. In column 1, the information is stored in mixed case. So it might contain Jones Smith O'Malley In column 2, the name was entered via software which caused the letters to be upper case, and did not permit entry of special characters like the apostrophe. So its corresponding values would be JONES SMITH O MALLEY The where expression I am trying to get to work is (upper(table1.last_name,'''','_') not like table2.last_name) (this is just one part of a more complicated condition statement) This produces nearly the results I want - except for that pesky apostrophe. So I tried (upper(replace(table1.last_name,'''','_')) not like table2.last_name) but I do not see any difference in the items returned. Is there some other techniques needed for this type of thing? What version of Oracle? |
|
On 10g plus you have the regular expression functions that could be used. *These functions have a case insensitive option. On all versions you have the replace function which could be used to remove the pesky apostrophe from the one column. |
#9
| |||
| |||
|
|
last thought: white space Is there trailing white space on either name? Does the table2 'O MALLEY' value have one or two spaces between the O and the M?? |
#10
| |||
| |||
|
|
On Mar 27, 9:48*am, Ed Prochak <edproc... (AT) gmail (DOT) com> wrote: last thought: white space Is there trailing white space on either name? Does the table2 'O MALLEY' value have one or two spaces between the O and the M?? Good point! I just posted what my actual issue was - but you do point out a good point. That earlier mention of a regular expression function is sounding better and better. Then I might be able to say something like [' ]* for the match. Hmm. I really appreciate everyone's comments. |
![]() |
| Thread Tools | |
| Display Modes | |
| |