Returning arrays from stored proc to java ?

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?
 
mespoAsked:
Who is Participating?
 
CalronCommented:
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
 
CalronCommented:
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
 
mespoAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.