Oracle search list of words in string and retruen existing ones

后端 未结 2 1490
甜味超标
甜味超标 2021-01-28 14:22

I am trying to write a statistic about the data warehouse tables that are used.

Therefor I should make a query to bring the used tables.

I have a list of table n

2条回答
  •  孤独总比滥情好
    2021-01-28 15:10

    Here is the solution that I searched for:

    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;
    

提交回复
热议问题