• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

registerOutParameter for table?

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the Object Example on OTN. It demonstrates two ways to do this.
 
Ranch Hand
Posts: 77
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 77
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .




 
You can't have everything. Where would you put it?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic