【发布时间】:2012-02-12 08:23:45
【问题描述】:
我正在使用 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;
}
}
);
【问题讨论】:
-
你想要什么?您的 SQL 不是查询(即不返回任何内容),而您还是这样做了
return null所以......? -
我需要访问变量的值(例如
id_out)
标签: java plsql spring-jdbc