简体   繁体   English

statement.execute()在PL / SQL结束时返回Slash错误

[英]statement.execute() returns error with Slash at the end of PL/SQL

When executing pl/sql im obtaining an error : 执行pl / sql时获取错误:

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

PLSQL example: 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: 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 谢谢

The slash is how you execute the anonymous block through an interactive environment such as SQL*Plus. 斜杠是通过SQL * Plus等交互式环境执行匿名块的方式。 If you are executing this block by a call from Java you don't need the terminating slash. 如果通过Java调用执行此块,则不需要使用终止斜杠。

Found answer. 找到答案。 Had to made more complcated request to google :) 不得不向谷歌提出更多的complcated请求:)

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. 在sqldev中使用sqlplus或SQL工作表时,可以使用斜杠附加PL / SQL块。 However, when using the procedure editor (native to sqldev), you'll have to remove it. 但是,在使用过程编辑器(sqldev本机)时,您必须将其删除。 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 http://forums.oracle.com/forums/thread.jspa?threadID=519670

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM