[英]SQLSyntaxErrorException: ORA-00900: invalid SQL statement using Java
I need to use following via Java EXEC DBMS_STREAMS_ADM.SET_TAG(tag => HEXTORAW('17'));
我需要通过Java
EXEC DBMS_STREAMS_ADM.SET_TAG(tag => HEXTORAW('17'));
使用以下EXEC DBMS_STREAMS_ADM.SET_TAG(tag => HEXTORAW('17'));
using a simple Database client. 使用一个简单的数据库客户端。 along with other usual select/delete queries but its complaining for invalid SQL statement.
以及其他常用的选择/删除查询,但抱怨无效的SQL语句。
I tried removing the exec as its for PL/SQL and calling it with {} but still I am getting the same error. 我试着删除exec作为PL / SQL的代码,并用{}调用它,但是仍然遇到相同的错误。
EXEC
is SQL*Plus (Oracle's native SQL client) syntax and you can't use it here. EXEC
是SQL * Plus(Oracle的本机SQL客户端)语法,您不能在这里使用它。 The JDBC syntax for calling stored procedures is through the CALL
directive. 调用存储过程的JDBC语法是通过
CALL
指令实现的。 You can omit the parameter name in the call ( tag => HEXTORAW('17')
). 您可以在调用中省略参数名称(
tag => HEXTORAW('17')
)。 For example: 例如:
try (CallableStatement cs
= myConnection.prepareCall("{ call DBMS_STREAMS_ADM.SET_TAG(HEXTORAW(?)) }")) {
cs.setString(1, "17");
cs.execute();
}
It is unclear which DBClient
you are currently using (please tell us), but the following might work as well: 目前尚不清楚您当前正在使用哪个
DBClient
(请告诉我们),但是以下方法也可以工作:
DBClient.execute("{ call DBMS_STREAMS_ADM.set_tag(HEXTORAW('17')) }");
or then 或然后
DBClient.execute("begin DBMS_STREAMS_ADM.SET_TAG(HEXTORAW('17')); end;");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.