declare
v_Sql varchar2(2000);
v_count number;
begin
for xx in (select t.OWNER, t.TABLE_NAME, t.COLUMN_NAME
from dba_tab_columns t
where t.OWNER = upper('限制用户')
and TABLE_NAME in (select distinct TABLE_NAME from dba_tab_columns where OWNER = upper('限制用户')
and TABLE_NAME like upper('限制表%')
and COLUMN_NAME = upper('限制字段')
)
) loop
v_Sql := 'select count(1) from ' || xx.owner || '.' || xx.table_name ||' where '
|| xx.column_name || ' like ''输入要查找的数据'' and data_dt = ''yyyy-mm-dd'' '; --限制搜索日期
execute immediate v_Sql into v_count;
if (v_count >= 1) then
dbms_output.put_line(xx.table_name || ':' || xx.column_name);
end if;
end loop;
end;
[Oracle] 遍历数据库查找字符串
于 2024-01-19 09:21:18 首次发布