wood burning stoves*
The moose likes JDBC and the fly likes registerOutParameter for table? 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 "registerOutParameter for table?" Watch "registerOutParameter for table?" New topic

registerOutParameter for table?

meera rao
Ranch Hand

Joined: Jun 30, 2005
Posts: 67
I have a record and table of type this record

TYPE owner_Rec IS RECORD (

ssn CHAR (9),
address VARCHAR2(120) );

TYPE Owner_tbl IS TABLE OF owner_Rec

This I am sending as an out parameter in my stored procedure.

How should i access this table in my java code , what should i mention in registerOutParameter

cs = (OracleCallableStatement) conn.prepareCall("{call GET_OWNER(?)}");

cs.registerOutParameter (1, );
[ August 17, 2005: Message edited by: Bear Bibeault ]
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
See the Object Example on OTN. It demonstrates two ways to do this.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 58

Carl Trusiak wrote:See the Object Example on OTN. It demonstrates two ways to do this.

This link is not available now. I am looking for the same solution. I want the solution exactly for this question in this thread. Can anyone provide the similar solution that was in this link?
Martin Vajsar

Joined: Aug 22, 2010
Posts: 3606

There is a page on this topic here on the Ranch. It only lists the caveats, but there is also a link on that page to a thread where one of our users posted code which worked for him. And of course, as a last resort, links to documentation.
Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 58

I am posting the solution for the appraoch i used. Just might be useful for someone in the future:

If you are using oracle.sql.ARRAY or STRUCT to represent the OUT Parameter in callable statement, ten you should register the out parameter along with the sql type name defined in the DB.

Find the below code in which Employee is represented as STRUCT, and the EMPLOYEE_LIST as ARRAY .

jQuery in Action, 2nd edition
subject: registerOutParameter for table?
Similar Threads
how to get oracle collection ( table / record ) into java
Oracle sql exception:
registerOutParameter Problem when the type is ARRAY
Registering IN OUT parameter
CallableStatement Error