如:每周五0:30删除所有以tmp开头的表???这样的语句该怎么写--oracle

解决方案 »

  1.   

    做个过程:通过查询DBA_TABLES,获得TABLE_NAME中所有TMP开头的表的名字,全部drop掉.
    然后在windows 里做个计划任务每到周五的0:30就调用这个过程
      

  2.   

    怎么查 上面的兄台已经讲的比较明白了.如果没有 windows操作系统的话 可以在oracle中建job  效果同
      

  3.   

    create or replace procedure ymq_test is 
     temptablenames varchar2(100);
     cursor c_emp is 
       select table_name
       from sys.dba_tables
       where tablespace_name='MOF'
       and table_name like 'TMP%'
       and owner='YMQ';
    begin
     open c_emp;
     loop
      fetch c_emp
        into temptablesname;
      exit when c_emp%notfound;
      execute immediate 'drop'11temptablename'';
     end loop;
     close c_emp;
    end;编译错误 pl/sql:ora-00942:表或视图不存在。其中11代表双竖线,那个键坏了所以用11来代替。
      

  4.   

    是你的当前用户没有访问sys.dba_tables的权限吧。
    另外dba_tables也没必要加sys.'drop'11temptablename''  缺少table关键字。
    可以通过dbms_job包调用这个procedure,来实现自动执行。
      

  5.   

    那如何给ymq赋权限呢?赋什么权限???
      

  6.   

    赋上select any dictionary的权限就解决问题了。