用户a有很多表,需要查找以tabdc开头的表,并清空其中的内容,求sql语句。谢谢!!!

解决方案 »

  1.   

    select * from all_tables where owner = 'A' and table_name like 'tabdc%'
      

  2.   

    查找表
    select * from dba_tables where table_name like 'TABDC%' and owner = 'A'要自动清空应该用pl/sql。
      

  3.   

    以该表头开始的表很多,再求一下自动清除数据的sql。谢谢了
      

  4.   

    循环取得相应的表名,然后
    truncate table table_name,可以写个过程。注意truncate的使用,效率高但数据不能回滚。
    如:
    create or replace procedure clear_table_p()
    as
    v_sql varchar2(100);
    begin
    for cur in select table_name from all_tables where table_name like 'TABDC%' and owner = 'A' loop
    v_sql := truncate table cur.table_name;
    execute immediate v_sql;
    end loop;
    end;
    /
      

  5.   

    SELECT 'delete from '''||tname||'''' FROM tab WHERE tNAME LIKE TABDC%' and  owner = 'A'