Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring JDBCTemplate procedure

 
Niall Loughnane
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to send a request via Spring JDBCTemplate to an Oracle Stored procedure,

the signature of the Oracle procedure is:

PROCEDURE METHOD_NAME (param0 VARCHAR2, param1 newType, param2 NUMBER(19,0) DEFAULT NULL, param3 DATE DEFAULT NULL, param4 VARCHAR2 DEFAULT NULL) AS

where newType is of type "AS TABLE OF number(19)"




what should the method for calling this stored procedure using Spring JDBCTemplate?



currently my code is:



Thanks in Advance,

Niall
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags next time.

I'll move this thread to our Spring forum.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look for a class called StoredProcedure from Spring. The constructor is used to setup the in and out parameter type and names, then the execute method is to assign values to the in parameters and to execute the stored procedure and take the out parameters returned.

Then you just instantiate the StoredProcedure implementation and call the execute method.

Here is the documentation
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html#jdbc-StoredProcedure

Or you can also do it this way

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html#jdbc-simple-jdbc-call-1

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic