试图从没有行的架构中删除所有表?

时间:2010-05-08 06:48:55

标签: plsql plsqldeveloper

我试图删除没有行的架构中的所有表,但是当我执行此代码时 我收到了错误

THis is the code:


 create or replace procedure tester
       IS
       v_count NUMBER;
       CURSOR emp_cur
      IS
      select table_name from user_tables;
      BEGIN
          FOR emp_rec_cur IN emp_cur LOOP
            EXECUTE IMMEDIATE 'select count(*) from '|| emp_rec_cur.table_name INTO   v_count ;
            IF v_count =0 THEN
           EXECUTE  IMMEDIATE 'DROP TABLE '|| emp_rec_cur.table_name;
               END IF;
              END LOOP;
      END tester;

ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "identifier": expecting one of: "badfile, byteordermark, characterset, data, delimited, discardfile, exit, fields,
fixed, load, logfile, nodiscardfile, nobadfile, nologfile, date_cache, processing, readsize, string, skip, variable"
KUP-01008: the bad identifier was: DELIMETED
KUP-01007: at line 1 column 9
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1
ORA-06512: at "SCOTT.TESTER", line 9
ORA-06512: at line 1

1 个答案:

答案 0 :(得分:3)

ORACLE_LOADER正在引发错误。我怀疑你的循环是找到一个外部表,它的定义有问题 - KUP-01008抱怨关键字“DELIMETED”,但外部表语法包含关键字“DELIMITED”。

如果您不打算删除外部表,可能需要在查询中省略它们,例如:

CURSOR emp_cur IS
SELECT table_name FROM user_tables
MINUS
SELECT table_name FROM user_external_tables;