PL / SQL to search a string in whole database
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