Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Complex data object returned from oracle

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

It is my first time posting question here, and if anything not clear please let me know. I am having trouble with complex object returned from stored procedure. I have something like this:

Then I do this is java:

My issue is when array.getArray() (Point A) is called, then it calls A.readSQL() (Point B) first so that all data is set and saved somewhere. Then at Point C, it calls A.readSQL() again but at this time there no more data to read as it has been read, and the result is I get B object with null values, no exception occurs. I been struggling for 2 days and couldn't figure it out. Everything parses out correctly if I use B as param instead of BLIST.

Please help. Thanks.

Posts: 22002
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Din Carl! Can you please UseCodeTags next time? It makes your code easier to read.
Ranch Hand
Posts: 1143
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest using Oracle's JDBC thin driver which maps database table types, like your BLIST type, to java.sql.Array and object types, like your types A and B, to java.sql.Struct.
Also, I personally prefer using a PL/SQL stored function, rather than a stored procedure with an OUT parameter.

Good Luck,
He's giving us the slip! Quick! Grab this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic