sql - Oracle: LIKE where any part of one string matches any part of another string -


I am using PL / SQL v7.1

I can find records of all addresses I am trying to see where the country's name has been entered in one address line areas and also in the area of ​​the country. The problem is that the details of the country have not been recorded continuously, eg.

  addr4 addr5 country ---------- ---------- --- ------------ Jersey UK (Jersey) Ireland Republic of Oberland Douglas Man UK (Isle of Man)  

So, I need to find that record found in any part of the country either in ADR4 or ADR5 goes.

I started with it

  SELECT * test_addresses WHERE addr4 || Addr5 as '%' | | Country || '%'  

I know this does not work because it takes the first record as an example, check that the 'UK (Jersey)' is found in adr4 or No. | Ederr 5 and, therefore, no matches will be found. But how do I check that 'jercia' is found in Adar 4? Addr5

Try this way:

  SELECT * test_addresses WHERE (ADR4 is not empty and countries like '%' are ADR4 || '%') or (ADR5 is not empty and country is like '%') ADR5 || '%')  


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -