Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

registerOutParameter for table?

 
meera rao
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the Object Example on OTN. It demonstrates two ways to do this.
 
Mohamed Iqzas
Ranch Hand
Posts: 73
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .




 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic