通过 Java 代码调用 Oracle 存储过程时出错
Error when calling an Oracle stored procedure though Java code
我正在 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();
但是我在 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
我哪里做错了?
:=
错误,return 参数的占位符必须列在 call
关键字之前 as documented in the JavaDocs ):
connection.prepareCall("{?= call pkg_temp.update_data(?, ?)}");
我正在 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();
但是我在 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
我哪里做错了?
:=
错误,return 参数的占位符必须列在 call
关键字之前 as documented in the JavaDocs ):
connection.prepareCall("{?= call pkg_temp.update_data(?, ?)}");