Find A Search String in All Tables
Find A Search String in All Tables
Find A Search String in All Tables
--DECLARE
match_count integer;
v_search_string varchar2(4000) := 'CSBNE';
BEGIN
FOR t IN (SELECT owner, table_name, column_name FROM dba_tab_cols where data_t
ype like '%CHAR%') 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_nam
e||' '||match_count );
insert into search_string values (t.owner,t.table_name,t.column_name,mat
ch_count);
END IF;
END LOOP;
END;
/
colsep ,
pagesize 0
trimspool on
headsep off
linesize 1000
numw 36
spool UCS_COMMS.csv
select * from UCS.UCS_COMMS where SERVICE_NUMBER like 'CSBNE%';
select count(*) from search_String where no_of_records > 0;
insert into search_string select
'UCS','UCS_SITE_AGREEMENTS_V','PMS_CURRENT_TENANT', count(*) from