Solved

Returning arrays from stored proc to java ?

Posted on 2001-06-28
3
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

729 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