This was what I was going for, but frankly, you don't even have to escape the _. Just the replace causes it to not match. Order in the join is important.

create or replace table kevin.testlike1 (column1 char(20));
create or replace table kevin.testlike2 (column2 char(20));

insert into kevin.testlike1 values('0110 EXFN 01 ABCD');
insert into kevin.testlike2 values('0110 EXFN 01'),('____ EXFN 01');

select * from kevin.testlike1 t1,
kevin.testlike2 t2
where
t1.column1 like trim(replace(t2.column2,'_','\_')) concat '%'
escape('\');




On Tue, 2021-10-19 at 13:18 -0500, Justin Taylor wrote:
I got it now. I'd have to replace all % and _ in one column and then
specify the ESCAPE on the LIKE clause.

Unfortunately, the mailing list corrupted the example you copied from the
SQL reference. Let's see if I have better luck.
SELECT *
FROM TABLEY
WHERE C1 LIKE 'AAAA+%BBB%' ESCAPE '+'

Thanks


date: Tue, 19 Oct 2021 13:10:35 +0000
from: Tim Fathers <tim@xxxxxxxxxxxxx<mailto:tim@xxxxxxxxxxxxx>>
subject: Re: LIKE quandary

You could specify an escape character for the wildcard characters like
this:

SELECT *
FROM TABLEY
WHERE C1 LIKE ?AAAA+%BBB%? ESCAPE ?+?

Tim.



[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp]
Kevin Bucknum

Senior Programmer Analyst

MEDDATA / MEDTRON

120 Innwood Drive
Covington LA 70433
Local: 985-893-2550<tel:985-893-2550>
Toll Free: 877-893-2550<tel:877-893-2550>
https://www.medtronsoftware.com


CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.