declare
rscount int ;
strsql varchar(20000) ;
begin
for x in (select t.tname , c.cname
from col c, tab t
where c.tname = t.tname and t.tabtype ='TABLE' and coltype in('VARCHAR2','VARCHAR','NVARCHAR2','CHAR')
)
loop
strsql := 'select count(*) from ' || x.tname || ' where ' || x.cname || ' =''查找内容''';
execute immediate strsql into rscount ;
if rscount > 0 then
dbms_output.put_line(x.tname || '.' || x.cname) ;
end if ;
end loop ;
end ;
在数据库所有表的所有字段里面查找指定内容
最新推荐文章于 2024-08-04 10:06:58 发布