orcale查询某个内容所在的位置

declare 
    rscount int ; 
    strsql varchar(200) ; 
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','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 ; 

猜你喜欢

转载自blog.csdn.net/nuoyuezuo/article/details/90696218
今日推荐