Author
Spring JDBCTemplate procedure
Niall Loughnane
Ranch Hand
Joined: Dec 07, 2006
Posts: 200
posted May 25, 2011 11:41:20
0
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
Joined: Oct 27, 2005
Posts: 19216
Please UseCodeTags next time.
I'll move this thread to our Spring forum.
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Mark Spritzler
ranger
Sheriff
Joined: Feb 05, 2001
Posts: 17234
posted May 26, 2011 12:04:23
0
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
Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
subject: Spring JDBCTemplate procedure