我正在使用NamedParameterJdbcTemplate运行pl/sql脚本.但我不知道如何获得out变量的值(:id_out).提前致谢.
String script = "declare
begin
if myFunc(:id_in) is null then
:id_out := 0;
else
:id_out := 1;
end if;
end;";
Map<String,Object> bindVars = new HashMap<String, Object>();
bindVars.put(id_in,1);
bindVars.put(id_out,2);
jdbcTmpl.execute(script, bindVars, new PreparedStatementCallback<Object>() {
@Override public Object doInPreparedStatement(PreparedStatement cs)
throws SQLException, DataAccessException {
cs.execute();
return null;
}
}
);
Run Code Online (Sandbox Code Playgroud)