I am looking for the solution to search string/number in oracle all tables and columns.
I checked online and could find many solutions.
But when I am executing below solution in SQL Oracle developer, it creates anonymous block.
Can anyone help me how to use below solution in Oracle to get the results.
DECLARE
match_count integer;
v_search_string varchar2(4000) := <<string you want to search for>>;
BEGIN
FOR t IN (SELECT owner, table_name, column_name FROM all_tab_columns) LOOP
EXECUTE IMMEDIATE
'SELECT COUNT(*) FROM '||t.owner || '.' || t.table_name||
' WHERE '||t.column_name||' = :1'
INTO match_count
USING v_search_string;
IF match_count > 0 THEN
dbms_output.put_line( t.owner || '.' || t.table_name ||' '||t.column_name||' '||match_count );
END IF;
END LOOP;
END;
/
Please help as I am new in Oracle.
Thanks in advabce