javasqlspringoracle-databasesimplejdbccall

Is there optinal stored procedure parameters support in SimpleJdbcCall of Spring framework?


So i have stored procedure in my Oracle database with default and in-database parameters:

procedure cool_procedure(
    i_id          in      number
  , i_number        in      varchar2
  , i_check  in      number default 1
  , i_commit           in      number := GLOBALS.commit_yes
  , o_result         out     number
);

Can i somehow call it with simplejdbccall without setting i_comit and i_check?

This is what i actually want to do:

var jdbcCall = simpleJdbcCallFactory.create(jdbcTemplate)
.withSchemaName("SCHEMA")
.withCatalogName("CATALOG")
.withProcedureName("cool_procedure")
.withoutProcedureColumnMetaDataAccess()
.declareParameters(
        new SqlParameter("i_id", Types.NUMERIC),
        new SqlParameter("i_name", Types.VARCHAR),
        new SqlParameter("i_check", Types.NUMERIC),
        new SqlParameter("i_commit", Types.NUMERIC),
        new SqlOutParameter("o_result", Types.NUMERIC)
);

var paramMap = new MapSqlParameterSource()
.addValue("i_id", id)
.addValue("i_name", name);

var out = new LinkedCaseInsensitiveMap<>();
out.putAll(jdbcCall.execute(paramMap));

But i get an error, that states i have missed required parameter...

So can i somehow NOT add i_check and i_commit to paramMap of MapSqlParameterSource?


Solution

  • Try with

     .withoutProcedureColumnMetaDataAccess()
     .withNamedBinding()