declare
cursor t_sor is
select table_name from user_table;
num number:=0;
begin
for v_sor in t_sor loop
execute immediate 'select count(1) from '||v_sor.table_name into num;
if num=0 then
dbms_output.put_line(v_sor.table_name);
end if;
end loop;
end;
/

解决方案 »

  1.   

    好像没有直接的命令,自己写一个过程吧:
    思路如下:
    select 'select * from ' || table_name || ';' from user_tables;
    上面的语句返回一个结果集,用游标来指示,执行获得的每一个:select * from tb_name;语句,在执行后判断sql%count的值,如果sql%count为‘0’那说明刚刚的表中没有数据,如果sql%count不为‘0’说明有数据,这样就可以判断了。
    具体的实现可以自己考虑。
      

  2.   

    多谢楼上。
    没来及测试,又有一问题
    表中一字段值类似15GrMo,N千条这种含有Gr的数据,怎么用一sql把Gr换成Cr
    即成为15CrMo多谢。如可以另开贴,只是时间及没来及。
      

  3.   

    update tbname set col=replace(col,'Gr','Cr')
    where instr(col,'Gr')>0;