aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "registerOutParameter for table?" Watch "registerOutParameter for table?" New topic
Author

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),
NAME VARCHAR2 (60),
address VARCHAR2(120) );

TYPE Owner_tbl IS TABLE OF owner_Rec
INDEX BY BINARY_INTEGER;

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
Sheriff

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: 61

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
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

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: 61

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 .




 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: registerOutParameter for table?