title: How to Execute an SQL Anonymous Block in DB2?
body: <p>I want to make a search through a schema of columns whose data includes 'ABC'. In Oracle PL/SQL, I would do it like this:</p>
  
  <pre><code>DECLARE
    v_cnt integer;
  BEGIN
  
    for i in (select tabname, colname
                from all_tab_cols --syscat.columns
               where tabschema = 'DATA'
            order by tabname, colname)
    loop 
  
      execute immediate '
      select count(1)
      from '||i.tabname||'
      where upper('||i.colname||') like ''%ABC%''' into v_cnt;
  
      if v_cnt &gt; 0 then 
        dbms_output.put_line(i.tabname||' - '||i.colname)
      end if;
  
    end loop;
  
  END;
  </code></pre>
  
  <p>However it is in an DB2 database. I have tried search online for the correct syntax, but I cannot find it. syscat.columns is the oracle equivalent for all_tab_cols, so I just need the correct syntax for an anonoymous SQL block in DB2. </p>
  
  <p>Would anyone help me with the syntax, please?</p>