title: How to select records whose value does not match the list of strings from another query in oracle?
body: <p>I have two unrelated queries. I need to select records from first query whose column value does not contain any of the values returned from another query. Please suggest a way to do this.</p>
  
  <p>Let us say, first query returns these records:</p>
  
  <pre><code>abc_123_xyz
  def_456_hij
  lmn_opq
  rst_uvw
  </code></pre>
  
  <p>Let us say, second query returns these records:</p>
  
  <pre><code>123
  456
  </code></pre>
  
  <p>The expected result is:</p>
  
  <pre><code>lmn_opq
  rst_uvw
  </code></pre>
  
  <p>I have written a query which matches the result and it works fine. But when I add <code>NOT LIKE</code>condition, it fails. Please help!</p>
  
  <pre><code>select o.name 
   from (select pattern from PATTERN) p, 
          objects o
   where o.name like '%'||p.pattern||'%';
  </code></pre>
  
  <p>Assuming PATTERN table returns <code>123,456</code>, it matches the values <code>abc_123_xyz, def_456_hij</code> correctly. However if I execute above query with <code>NOT LIKE</code> condition, it fails to return only the other two records. Instead it returns all four values. What is wrong here?</p>