gpt4 book ai didi

java - statement.execute() 在 PL/SQL 末尾返回带有斜杠的错误

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:51:40 27 4
gpt4 key购买 nike

执行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)执行匿名 block 的方式。如果您通过 Java 调用执行此 block ,则不需要终止斜杠。

关于java - statement.execute() 在 PL/SQL 末尾返回带有斜杠的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2289723/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com