Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is the sticky point: </p> <blockquote> <p>"The phrase can be anything of 3 characters minimum. "</p> </blockquote> <p>I hope what you mean is you want to scan the table for a given search pattern which can comprise three or more characters. That's easy</p> <pre><code>select employee_id , employee_name from ( with data as ( select employee_id , employee_name , case when instr(employee_name, '&amp;search_pattern ) &gt; 0 then 1 else 0 end as i from employees ) select employee_id , employee_name , sum(i ) over () as cnt from data where i &gt; 0 ) where cnt &gt;= 5; </code></pre> <p>Now if what you means is you want to scan through every EMPLOYEE_NAME, establish every set of characters in that text and then search all the other rows for occurences of those patterns, well, then good luck. I hope you have a raging beast of a server with much RAM and many cores, because you will need a lot of crunch (or a very small table!).</p> <p>From your comment it would appear that this latter option is what you want. So, here is a query which will identify all the three-character segements in your code. You can use this to generate a feed of search patterns which you can feed into the query I posted above.</p> <pre><code>select employee_name, triple from ( with data as ( select max(length(employee_name)) as mx from employee ) select employee_name , substr(employee_name, level, ,3) as triple from employee , data connect by level &lt;= data.mx ) where length(triple) = 3; </code></pre> <p>In real life you'll want to select just the DISTINCT triples but I left the other column in to provide context for the results. </p> <p>Extending this solution to find segments of three or more characters is left as an exercise for the reader ;) </p> <hr> <blockquote> <p>"I was hoping to find a simple solution. It amazes me that nobody come across this issue so far."</p> </blockquote> <p>Well then it's time to wake up and smell the coffee. <a href="http://www.joelonsoftware.com/articles/fog0000000319.html" rel="nofollow">String manipulation is <em>computationally expensive</em>.</a>. The reason why people spend so much time and money developing database schemas is so we don't have to invest large amounts of effort scanning long strings for ad hoc patterns.</p> <p>Your scenario is the exact opposite of what we would expect to find in any database. That's why there isn't a pre-canned solution, let alone a simple one.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload