I need to search all tables in an oracle database for a specific string and return all the records where that string is found. I am working with SQL Developer. There are several really useful scripts and stored procedures that have been posted online that provide a way to search the entire database and they all seem to be able to return the table name and the column name where the string is found. I actually want to see the rows like a select * statement but I would like it to be for all the tables in my database. I want to note that I am very much a beginner and I'm not familiar with advanced PL/SQL scripting and database concepts so though I've tried and tried I can't seem to figure it out so any input would be appreciated.
Here is a script that I was trying to modify (someone else's solution)
declare
l_count number := 0;
l_str varchar2(20) := '%test%';
begin
for rec in (select table_name, column_name
from user_tab_columns
where data_type in ( 'VARCHAR2' , 'VARCHAR', 'CHAR' ) ) loop
execute immediate 'select count(*) from '||rec.table_name||
' where '||rec.column_name||' like '''||l_str||'''' into l_count;
if l_count > 0 then
dbms_output.put_line('Table : '||rec.table_name||' '||rec.column_name);
end if;
end loop;
end;
/