没有参数的 JdbcTemplate 和存储过程
JdbcTemplate and stored procedure without params
我想在 Spring 使用 JdbcTemplate 启动时调用存储过程。
在我的 Oracle 数据库中:
CREATE OR REPLACE PACKAGE BODY P_MENU AS
..
procedure menusVegans
is
..
END;
来自我的 Java 应用程序。我试过了
jdbcTemplate.update("call P_MENU.menusVegans");
和
jdbcTemplate.execute("P_MENU.menusVegans");
和
jdbcTemplate.execute("call P_MENU.menusVegans");
和
jdbcTemplate.execute("execute call P_MENU.menusVegans");
和
SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(jdbcTemplate)
.withProcedureName("P_MENU.menusVegans");
simpleJdbcCall.execute(null);
全部有错误。
而不是使用
call P_MENU.menusVegans
您应该使用匿名 PL/SQL 块:
BEGIN P_MENU.menusVegans; END
我想在 Spring 使用 JdbcTemplate 启动时调用存储过程。
在我的 Oracle 数据库中:
CREATE OR REPLACE PACKAGE BODY P_MENU AS
..
procedure menusVegans
is
..
END;
来自我的 Java 应用程序。我试过了
jdbcTemplate.update("call P_MENU.menusVegans");
和
jdbcTemplate.execute("P_MENU.menusVegans");
和
jdbcTemplate.execute("call P_MENU.menusVegans");
和
jdbcTemplate.execute("execute call P_MENU.menusVegans");
和
SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(jdbcTemplate)
.withProcedureName("P_MENU.menusVegans");
simpleJdbcCall.execute(null);
全部有错误。
而不是使用
call P_MENU.menusVegans
您应该使用匿名 PL/SQL 块:
BEGIN P_MENU.menusVegans; END