This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2-D array jdbc and Oracle

 
Nena Katz
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would a 2 dimensional array be created in a stored function. Once done how would it be retreived using JDBC.
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nena,
Although I've never done this (and I'm too lazy to try it), I would suggest using a nested table -- whose elements were all, themselves, nested tables.

In order to access nested tables via JDBC, use the ARRAY type. Search this forum's archives for the term "ARRAY", and you should find plenty of details.

Good Luck,
Avi.
 
Nena Katz
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds like a good suggestion if I were building a schema. However, I am dealing with an existing database - there are no nested tables. I need to retreive a 2 Dimensional array from a stored procedure. Any suggestions.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nena,
You could create a temp table in your stored proc.

What are you trying to accomplish with the nested tables? It might be easier to have the key for the nested table as a column and use one layer of tables.
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nena,
Here goes...


But since you say you can't create database types, I guess you're up sh*t creek (as Jake Blues said to the Penguin).

By the way, the inspiration for the above code, came from the following discussion at the Ask Tom Web site:

http://tinyurl.com/dx3tb

Good Luck,
Avi.
[ May 25, 2005: Message edited by: Jeanne Boyarsky ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic