简体   繁体   English

通过Java代码调用Oracle存储过程时出错

[英]Error when calling an Oracle stored procedure though Java code

I am calling a PL/SQL procedure in a Java application to update a database entry. 我正在Java应用程序中调用PL / SQL过程来更新数据库条目。

Connection connection = null;
CallableStatement preparedCall = null;
Integer result = 0;
preparedCall = connection.prepareCall("{ call ? := pkg_temp.update_data(?, ?)}");
preparedCall.registerOutParameter(1, OracleTypes.INTEGER);
preparedCall.setString(2, variable1);
preparedCall.setString(3, cariable2);
result = preparedCall.executeUpdate();

But I am getting the below error at executeUpdate() 但是我在executeUpdate()中收到以下错误

Caused by: java.sql.SQLException: ORA-06550: line 1, column 11:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
:= . ( @ % ; indicator
ORA-06550: line 1, column 51:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
. ( ) , * % & - + / at mod remainder rem <an exponent (**)>
and or || multiset

Where am I doing wrong? 我在哪里做错了?

:=是错误的,并且return参数的占位符必须在call关键字之前列出( 如JavaDocs中所述 ):

connection.prepareCall("{?= call pkg_temp.update_data(?, ?)}");

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

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