How to read a list returned by Java in PL/SQL?
617864Feb 21 2008 — edited Feb 21 2008Hi All,
I think I really need some help since I have stuck on this problem for the whole day and anyone who could help will be really appreciated.
I am currently having my PL/SQL call a java method to get a list of String, I created the Java code in PL/SQL as the following:
create or replace java source named "Generator" as
public class Generator {
public static java.util.List getNumberList(java.lang.String rangeStart, java.lang.String rangeEnd) throws java.lang.Exception {
...
}
The java class is compiled and created in PL/SQL successfully.
The I need to have my PL/SQL function to call this Java code, I use a cursor to read the List:
create or replace package pkg_list
as
type pkg_no is ref cursor;
end pkg_list;
create or replace function generateNo (start_number VARCHAR2, end_number VARCHAR2) return pkg_list.pkg_no
as language java name
'Generator.getNumberList(java.lang.String,java.lang.String) return java.util.List';
The function is created without problem.
Then I start to call the function in my procedure:
CURSOR myList is (select generateNo (no_start, no_end) from dual);
BEGIN
FOR infringement_no IN infringementList LOOP
...
END LOOP;
END;
The procedure just gives me an error message:
PLS-00989: Cursor Variable in record, object, or collection is not supported by this release
Can anyone please give me a light to resolve this problem? Or at least some suggestion that I can read the Java List in PL/SQL?
By the way, I cannot upgrade the database.
Thank you.
Regards,
Zhan