You can do this with a single request, although it is a bit confusing. This query will look for all CHAR and VARCHAR2 columns in the current schema for the string 'JONES'
select table_name, column_name from( select table_name, column_name, to_number( extractvalue( xmltype( dbms_xmlgen.getxml( 'select count(*) c from ' || table_name || ' where to_char(' || column_name || ') = ''JONES''' ) ), 'ROWSET/ROW/C' ) ) cnt from (select utc.*, rownum from user_tab_columns utc where data_type in ('CHAR', 'VARCHAR2') ) ) where cnt >= 0
Note that this is an adapted version of the Laurent Schneider query to count the rows in each table with a single query.
Justin cave
source share