title: Oracle Search all tables all columns for string
body: <p>I need to search our oracle database for a string in all tables and columns. I have the below query I found online but when I execute it I get the following error</p>
  
  <p>Any help is appreciated</p>
  
  <pre><code>ORA-06550: line 6, column 31:
  PL/SQL: ORA-00904: "COLUMN_NAME": invalid identifier
  ORA-06550: line 6, column 12:
  PL/SQL: SQL Statement ignored
  ORA-06550: line 8, column 30:
  PLS-00364: loop index variable 'T' use is invalid
  ORA-06550: line 7, column 4:
  PL/SQL: Statement ignored
  ORA-06550: line 12, column 38:
  PLS-00364: loop index variable 'T' use is invalid
  ORA-06550: line 12, column 16:
  PL/SQL: Statement ignored
  
  BEGIN  
    FOR t IN (SELECT table_name, column_name FROM all_tables) LOOP   
     EXECUTE IMMEDIATE    
      'SELECT COUNT(*) FROM '||t.table_name||' WHERE '||t.column_name||' = :1'   
       INTO match_count  
         USING v_search_string; 
            IF match_count &gt; 0 THEN 
                 dbms_output.put_line( t.table_name ||' '||t.column_name||' '||match_count );
             END IF; 
    END LOOP;
  END;
  /
  </code></pre>