PLS-00103: 遇到符号 "end-of-file"

PLS-00103: Encountered the symbol "end-of-file"

我是运行下面的SQL块:

BEGIN 
  EXECUTE IMMEDIATE 'CREATE TABLE table_name (id INT NOT NULL)';
END;

并获得:

PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

   ( begin case declare end exception exit for goto if loop mod...

我很困惑,因为它在 Oracle SQL Developer 中运行良好,但是当我使用 Oracle JDBC 驱动程序执行它时,它会抛出此错误。

问题出在 Oracle 驱动程序解析 SQL 字符串的方式上。取出换行符修复它。