Solved

Returning arrays from stored proc to java ?

Posted on 2001-06-28
3
210 Views
Last Modified: 2010-08-05
Is it possible to return a non-scalar datatype i.e. index by table,record,varray  from a  stored proc or function ?
If it is, does anyone have any sample code?
 
0
Comment
Question by:mespo
  • 2
3 Comments
 
LVL 5

Expert Comment

by:Calron
ID: 6237014
I'm not sure if I understand you correctly, you want to know if it is possible to return an instance of a class from a function?

public Integer returnInt() {
  return new Integer(0);
}

In the same way you can return arrays, etc. For records just write your own class and return it as an instance of that class.

Hope this helps
0
 

Author Comment

by:mespo
ID: 6239019
For clarity, I'll include my pl/sql code.
My goal is to get the out param "My_Table" with a call from
jdbc. I've searched forever for a working example.
The problem I think is to find a compatable jdbc out parameter i.e. OracleTypes.ARRAY, java.sql.STRUCT.
Any help would be great.  
create or replace type test_type as object
(
 a varchar2(50)
)
//package
CREATE OR REPLACE PACKAGE "PKGTEST"                                                                                       IS

Type t Is Table Of test_type;
Mytable t;
PROCEDURE SelectRows(My_table OUT test_type);
End;
//package body
CREATE OR REPLACE PACKAGE BODY "PKGTEST"    
PROCEDURE SelectRows(My_table OUT test_type)
Is

Begin
 My_table:=test_type('a');

 END;
END;  
0
 
LVL 5

Accepted Solution

by:
Calron earned 200 total points
ID: 6243698
Sorry, I misunderstood your question the first time. I have no experience with sql so I won't be able to help you here. Sorry

Why don't you delete this question and use what you got when you reposted the question...
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HSSFWorkbook cannot be resolved error 10 66
JavaScript/Java - Changing an image background color 4 66
Apps blocked by Java 9 79
How to convert from xls to xlsx using java 7 35
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now