MyEclipse: Callable statements Oracle (skyway-spring-utils-7.1.3)

julio.salazar - May 01, 2012 - 12:15 AM
Post subject: Callable statements Oracle (skyway-spring-utils-7.1.3)
Hi,

I want to reuse some of the functions that skyway already has for calling Oracle procedures and functions, but I didn't found any documentation or examples of how I can accomplish this task with the spring mvc scafolding and the skyway-spring-utils-7.1.3.

Thanks in advance,
cconway - May 03, 2012 - 01:00 AM
Post subject:
Hi Julio,

Can you please elaborate on n the "functions Skyway already has for calling Oracle procedures and functions"? I'm not aware of the functions you are speaking of but would be happy to help once I better understand the question.
julio.salazar - May 03, 2012 - 04:41 PM
Post subject: solution found
Hi Cindy,

After some research and test I found that the below class has inheritance from SimpleJdbcCall (Spring jdbc core) and it seems to manage the execution of procedures and functions from the DB, in my particular case I'm using it on oracle 11g and I did the below implementation , maybe it will help someone in the near future. It will be nice to have some documented examples for an easier use.
skyway-sprint-utils-7.1.13.jar

org.springframework.jdbc.core.simple.SimpleJdbcCall
- org.skyway.spring.util.dao.call.MetaDataJdbcCall
- org.skyway.spring.util.dao.call.AdvancedMetaDataJdbcCall


Code:

--Procedure
   AdvancedMetaDataJdbcCall caller = dataStore.getJdbcHelper();
      caller.withProcedureName("pr_execute_dual");
      caller.setFunction(false);
      caller.addParameter(new SqlParameter("P_DUMMY", Types.NUMERIC));
      caller.withCatalogName("PKG_TESTING");

      SqlParameterSource in = new MapSqlParameterSource().addValue("P_DUMMY",
            new BigDecimal(264));

      caller.withSchemaName("TESTSCHEMA");
      caller.execute(in);

-- Function

      AdvancedMetaDataJdbcCall caller = dataStore.getJdbcHelper();
      caller.withFunctionName("f_execute_dual");
      caller.withCatalogName("PKG_TESTING");
      caller.setFunction(true);

      caller.addParameter(new SqlParameter(Types.NUMERIC));
      caller.addParameter(new SqlParameter("P_DUMMY", Types.INTEGER));
      caller.withSchemaName("TESTSCHEMA");

      SqlParameterSource in = new MapSqlParameterSource().addValue("P_DUMMY",
            473);

      BigDecimal value = caller.executeFunction(BigDecimal.class, in);


All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits