Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Returning arrays from stored proc to java ?

Posted on 2001-06-28
3
Medium Priority
?
213 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 400 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

876 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