|
Subject:
|
Retrieving returned value from stored proc
|
|
Posted By:
|
ajit
|
Post Date:
|
7/14/2006 8:43:33 AM
|
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
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
|
|
Reply By:
|
elishae
|
Reply Date:
|
8/29/2006 9:49:44 AM
|
either you can add output param for procedure, or make it a function for returning values.
and then execute the following code
CallableStatment cs = con.prepareCall({call sp_Test});
ResultSet rs = cs.executeQuery();
rs.getInt(1);
|