You are on page 1of 1

set serveroutput on;

declare
cursor c1 is select owner, table_name, column_name from dba_tab_cols where owner
not in ('SYSTEM',
'XDB',
'SYS',
'TSMSYS',
'MDSYS',
'EXFSYS',
'WMSYS',
'ORDSYS',
'OUTLN',
'DBSNMP') and data_type like '%CHAR%';
v_schema varchar2(100);
v_table varchar2(100);
v_column varchar2(100);
v_count number;
begin
execute immediate 'truncate table search_string';
open c1;
loop
<<fetch_cursor>> fetch c1 into v_schema, v_table, v_column;
exit when c1%notfound;
begin
execute immediate 'insert into search_string select ''' ||v_schema||''',
'''||v_table||''','''||v_column||''', count(*) from '||v_schema||'.'||v_table||'
where '||v_column ||' like ''CSBNE%''';
commit;
exception when others then dbms_output.put_line ('insert into search_str
ing select ''' ||v_schema||''','''||v_table||''','''||v_column||''', count(*) fr
om '||v_schema||'.'||v_table||' where '||v_column ||' like ''ABCD%''');
GOTO fetch_cursor;
end;
end loop;
close c1;
end;

You might also like