This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Calling Stored Procedure within package from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Calling Stored Procedure within package from Java" Watch "Calling Stored Procedure within package from Java" New topic
Author

Calling Stored Procedure within package from Java

visu Nekk
Ranch Hand

Joined: Sep 06, 2005
Posts: 122
Hi,

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

Thanks in advance,
Visu Nekk
John Bricconi
Greenhorn

Joined: Aug 23, 2007
Posts: 1
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling Stored Procedure within package from Java
 
Similar Threads
Is it possible to have a store procedre that has PL/SQL code and can call a java obje
Can we call java program from a Oracle stored procedure?
External tables and CallableStatement
Oracle stored procedure result set ref problem
How can I make this stored procedure work