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

执行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() );

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

谢谢

解决方法:

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

上一篇:plsql 函数的定义 包规范和包主体。


下一篇:直接使用java在Oracle数据库中创建函数