This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling Stored Procedure within package from Java

 
visu Nekk
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How to call a stored procedure within an oracle package from Java?

Thanks in advance,
Visu Nekk
 
John Bricconi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its quite like calling normal stored procedures.
Suppose you have this package:
create or replace package TEST_PACKAGE is
function TEST_PACKAGE_FUNCTION(c1 in double precision, c2 in double precision)
return double precision ;
end TEST_PACKAGE;

you just call it like this:
statement = connection.prepareCall("{ ? = call TEST_PACKAGE.TEST_PACKAGE_FUNCTION(?,?) }");
statement.registerOutParameter(1,java.sql.Types.DOUBLE);
....


Just use the dotted notation.

If you are interested in using stored procedure perhaps you can give a try to my tool spwrapper the netbeans plugin is quite handy to generate the code quickly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic