Retrieving return parameters from oracle Storedprocedures

Article ID: 1063
Last updated: 02 Feb, 2008
Article ID: 1063
Last updated: 02 Feb, 2008
Revision: 1
Views: 2860
Posted: 06 Oct, 1998
by Dean J.
Updated: 02 Feb, 2008
by Dean J.
Problem


When I try to retrieve the return parameters of oracle storedprocedures through fetchReturnValue(), I get the address locations of the variables instead of the expected values


Cause


This is a known problem, and has been brought to the attention of our development to search for a fix.


Action


The work around is to call asString() method on the output paramter.

For example if you have a storedproc

CREATE OR REPLACE PROCEDURE ORAPROC( num_in IN NUMBER, str_in IN VARCHAR2, num_out OUT NUMBER, str_out OUT VARCHAR2)
IS BEGIN
num_out := num_in; str_out := str_in;
END;

StoredProcedure proc = new StoredProcedure(conn,oraproc );
proc.setInt ( 101 );
proc.setString ( James Bond );

BoundObject out1 = new BoundObject ();
proc.setBoundObject ( out1 );
BoundObject out2 = new BoundObject ();
proc.setBoundObject ( out2 );

Result res = proc.execute ( conn1 );

System.out.println ( example.fetchReturnValue () );
System.out.println ( out1: + out1.asString() );
System.out.println ( out2: + out2.asString() );
This article was:   Helpful | Not helpful
Report an issue
Article ID: 1063
Last updated: 02 Feb, 2008
Revision: 1
Views: 2860
Posted: 06 Oct, 1998 by Dean J.
Updated: 02 Feb, 2008 by Dean J.

Others in this category