Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
|
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 14th, 2006, 08:43 AM
Authorized User
 
Join Date: Jun 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ajit
Default Retrieving returned value from stored proc

i have a stored proc that returns some value using return keyword(Not out put parameter). I am executing the stored proc using CallableStatement object. How can i retrieve the returned value from stored procedure. Ex Procedure could be as below
Code:
create procedure sp_Test
as
    declare LV_TestVar int
    if exists (select * from A)
          set LV_TestVar = -1
        return LV_TestVar
how can i retrieve the LV_TestVar using CallableStatement?.

Regards

Ajit
__________________
Ajit
 
Old August 29th, 2006, 09:49 AM
Registered User
 
Join Date: Aug 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to elishae
Default

either you can add output param for procedure, or make it a function for returning values.

and then execute the following code
Code:
CallableStatment cs = con.prepareCall({call sp_Test});
ResultSet rs = cs.executeQuery();
rs.getInt(1);





Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Proc vs Trigger carumuga SQL Server 2005 1 January 7th, 2008 11:38 AM
Calling an insert stored proc from a select stored dzitam SQL Language 10 April 2nd, 2007 12:39 PM
How to get value from stored proc busybee ASP.NET 1.0 and 1.1 Basics 4 April 2nd, 2006 01:06 AM
Use returned cursor in another PL/SQL proc robertogalbiati Oracle 0 January 5th, 2006 12:19 PM
manipulate multiple values returned by stored proc herlenrosa Beginning VB 6 3 November 11th, 2003 06:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.