select * from user_col_comments
    where lower(table_name) like '%test%' ;
select * from user_col_comments
    where lower(column_name) like '%test%' ;

解决方案 »

  1.   

    怎么在某Schame下搜索数据:
    比如:在scott用户下面,搜索含有'TEST'的数据的表和字段
    穷举法:
    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 = 'SCOTT') loop
        begin
          v_Sql := 'select count(1) from ' || xx.owner || '.' || xx.table_name ||
                   ' where ' || xx.column_name || ' like ''%TEST%'' ';
          execute immediate v_Sql
            into v_count;
          if (v_count >= 1) then
            dbms_output.put_line(xx.table_name || ':' || xx.column_name);
          end if;
        exception
          when others then
            null;
        end;
      end loop;
    end;
      

  2.   

    动态sql ,依次查询想干什么啊