More than a question, its an information sharing post.
I have come across a situation today where i needed to look for a sting in the entire database of an application with no idea of, which table/column it belongs to.
Below is a PL/SQL block i wrote and used to help my propose. Hope its helps others to with a similar requirement.
Declare
i NUMBER := 0;
counter_intable NUMBER :=0;
BEGIN
FOR rec IN (
select
'select count(*) ' ||
' from '||table_name||
' where '||column_name||' like''%732-851%'' ' as sql_command
from user_tab_columns
where data_type='VARCHAR2'
)
LOOP
execute immediate rec.sql_command into counter_intable;
IF counter_intable != 0 THEN
i := i + 1;
DBMS_OUTPUT.put_line ('Match found using command ::' || rec.sql_command);
DBMS_OUTPUT.put_line ('count ::' || counter_intable);
END IF;
END LOOP;
DBMS_OUTPUT.put_line ('total commands matched :: ' || i);
END;
replace your string at the place of : 732-851 in the code block