Oracle
 sql >> Base de Dados >  >> RDS >> Oracle

Oracle procura lista de palavras em string e retruen as existentes


Aqui está a solução que eu procurei:
WITH dwtables(dwtable) AS (
  SELECT 'DWA' FROM dual UNION ALL
  SELECT 'DWB' FROM dual UNION ALL
  SELECT 'DWC' FROM dual

)--> Tabelle mit einem Spalte (Liste)

SELECT title, 
    (SELECT LISTAGG (dwtable, ', ' ) WITHIN GROUP (ORDER BY dwtable)
     FROM dwtables
    WHERE REGEXP_LIKE (r.querytext, '(^|\s)'||dwtables.dwtable||'(\s|$)', 'i')) AS dwtables

 FROM Reports r;