这个简单的块有什么问题? PL SQL

What's wrong with this simple block? PL SQL

我正在尝试 运行 TOAD 上的这个简单的匿名块,但出现以下错误。有人能帮我吗?

这是代码:

BEGIN
FOR REC_CONF IN
(       
    SELECT DISTINCT CONF.SCHEMA, CONF.TABELLA, CONF.CAMPO, CONF.TIPO_CAMPO, CONF.LUNG_CAMPO, 
CONF.CAMPO_ACCESSO
    FROM EDWH.EDWH_GDPR_CONFIG CONF
    WHERE UPPER(FLAG_CANC) = 'Y'
    AND UPPER(SCHEMA) = UPPER('EDWH')
    ORDER BY CONF.TABELLA, CONF.CAMPO ASC
)
LOOP

    DBMS_OUTPUT.PUT_LINE (REC_CONF.TABELLA);
END LOOP;
END;

这应该循环到 EDWH.EDWH_GDPR_CONFIG 并将属性打印到 dbms_output.put_line 中。

这是我得到的错误:

[Error] Execution (10: 8): ORA-06550: row 10, column 8:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

   ( begin case declare exit for goto if loop mod null pragma
   raise return select update while with <an identifier>
   <identifier between quotes>
   <a bind variable> << continue close current delete fetch
   lock insert open rollback savepoint set sql execute commit
   forall merge pipe purge)

尝试在最后一个 "END;"

后添加“/”
END LOOP;
END;
/

再次执行

我相信您 运行 脚本的使用方式有误。这是一个 PL/SQL 脚本,因此 运行 它可以通过按 F9 键,或按“作为脚本执行”按钮在 TOAD 的工具栏中。

如果光标放在此代码中的某处(例如 BEGIN)并且您按下 <Ctrl + Enter>,那么您将得到

ORA-06550: line 12, column 4: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ( begin case declare exit for goto if loop mod null pragma raise return select update while with << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge

所以 - 运行 它作为 script.