statements.execute() 在 PL/SQL 末尾返回带有斜线的错误

发布于 2024-08-22 05:28:11 字数 711 浏览 5 评论 0原文

执行 pl/sql 时出现错误:

ORA-06550: line 1, column 316: PLS-00103: Encountered the symbol "/" The symbol "/" was ignored. 

PLSQL 示例:

DECLARE
   SQL1   VARCHAR2 (1500);
   SQL2   VARCHAR2 (1500);
BEGIN
   SQL1   := 'INSERT INTO das_html_caption VALUES (''test_test'')';
   SQL2   := 'DELETE FROM das_html_caption where wording = ''test_test''';

   EXECUTE IMMEDIATE SQL2;

   EXECUTE IMMEDIATE SQL1;

   EXECUTE IMMEDIATE SQL2;

   COMMIT;
END;
/

Java:

Statement statement = dbConnection.createStatement();
ResultSet rs = null;
boolean ret = statement.execute( sql.getValue() );

这是正确的错误吗?或者我做错了什么?

谢谢

When executing pl/sql im obtaining an error :

ORA-06550: line 1, column 316: PLS-00103: Encountered the symbol "/" The symbol "/" was ignored. 

PLSQL example:

DECLARE
   SQL1   VARCHAR2 (1500);
   SQL2   VARCHAR2 (1500);
BEGIN
   SQL1   := 'INSERT INTO das_html_caption VALUES (''test_test'')';
   SQL2   := 'DELETE FROM das_html_caption where wording = ''test_test''';

   EXECUTE IMMEDIATE SQL2;

   EXECUTE IMMEDIATE SQL1;

   EXECUTE IMMEDIATE SQL2;

   COMMIT;
END;
/

Java:

Statement statement = dbConnection.createStatement();
ResultSet rs = null;
boolean ret = statement.execute( sql.getValue() );

is it correct error ? or i'm doing something wrong ?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

又爬满兰若 2024-08-29 05:28:11

斜杠是您通过交互式环境(例如 SQL*Plus)执行匿名块的方式。如果您通过 Java 调用执行此块,则不需要终止斜杠。

The slash is how you execute the anonymous block through an interactive environment such as SQL*Plus. If you are executing this block by a call from Java you don't need the terminating slash.

别低头,皇冠会掉 2024-08-29 05:28:11

找到答案了。不得不向谷歌提出更复杂的请求:)

如消息所示,编译器
不想遇到这个符号
“/”,所以删除它即可。就这么简单。
让我解释一下。当使用 sqlplus 或
sqldev 中的 SQL 工作表,您可以
很好地附加你的 PL/SQL 块
斜线。然而,当使用
过程编辑器(sqldev 原生),
你必须将其删除。不知道
为什么他们制定这套规则,但是
直到他们放松为止,我们必须
服从他们;-)

http://forums.oracle.com/forums/thread .jspa?threadID=519670

Found answer. Had to made more complcated request to google :)

As the message indicates, the compiler
doesn't want to encounter the symbol
"/", so just remove it. That simple.
Let me explain. When using sqlplus or
an SQL worksheet in sqldev, you do
well appending your PL/SQL blocks with
the slash. However, when using the
procedure editor (native to sqldev),
you'll have to remove it. Don't know
why they made this set of rules, but
until they relax them, we'll have to
obey them ;-)

http://forums.oracle.com/forums/thread.jspa?threadID=519670

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文