1

错误:

ORA-06550: line1, column 22: PLS-00103 Encountered the symbol "end-of-file" when expecting one of the following: * & = - + .......

PL/SQL 块:

DECLARE v_c number :=0;
   BEGIN
      SELECT COUNT(*) into v_c from all_sequences where sequence_name='TEST_SEQ' and   sequence_owner='test';
      IF v_c = 1 THEN
         execute immediate 'DROP SEQUENCE test.TEST_SEQ';
      END IF;
   END;
/
4

2 回答 2

4

我从您的帖子中复制了代码并在 SQLDeveloper 和 SQLPlus 中运行它没有问题:

连接到:Oracle 数据库 11g 版本 11.2.0.3.0 - 生产

prompt> DECLARE v_c number :=0;                        
  2     BEGIN
  3        SELECT COUNT(*) into v_c from all_sequences where sequence_name='TEST_SEQ' and sequence_owner='test';
  4        IF v_c = 1 THEN
  5           execute immediate 'DROP SEQUENCE test.TEST_SEQ';
  6        END IF;
  7     END;
  8  /

PL/SQL procedure successfully completed.

你用的是什么工具?我最好的建议是在 SQLPlus 中尝试,如果仍然有错误,请向我们展示会话的全文。

于 2012-06-18T20:41:28.010 回答
4

您只执行第一行而不是整个 PL/SQL 块。

DECLARE v_c number :=0
/

导致:

DECLARE v_c number :=0
                 *
ERROR at line 1:
ORA-06550: line 1, column 22:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
following:
* & = - + ; < / > at in is mod remainder not rem

正如其他人建议的那样,在 SQLPlus 中试试这个。

于 2012-06-19T01:11:42.147 回答