retrieving arrays from stored procedure in 8i


[ Follow Ups ] [ Post Followup ] [ Message Board ]

Posted by 'Hema' on September 07, 2001 at 13:14:14 EST:


Hi,
I am using JDK1.2.2 & Oracle 8.1.7 with JDBC-Thin driver(classes12.zip).

I have a PL/SQL Stored Procedure that has an OUT parameter of type VARRAY.
The SP is shown below:

Note:
create or replace type v_empinfoarray as varray(100) of varchar2(80);

SP:
create or replace procedure sp_select_test (v_lname IN varchar2,
v_infoarray OUT v_empinfoarray,
v_result OUT number)
AS

CURSOR testcur is SELECT a.mail_stop, a.first_name
FROM emptable a WHERE lower(a.last_name)=lower(v_lname);
i number := 1;
v_mstop varchar2(15);
v_fname varchar2(30);

BEGIN
v_result := 0;

OPEN testcur;
loop exit when testcur%notfound;
FETCH testcur INTO v_mstop,v_fname;
v_infoarray(i) := v_mstop;
i:=i+1;
v_infoarray(i) := v_fname;
i:=i+1;
END LOOP;
EXCEPTION WHEN NO_DATA_FOUND THEN
v_result := 1;

END;
/


I am calling this SP from my Java program, the code fragment is below:
csmt = con.prepareCall("{call sp_select_test(?,?,?)}");
csmt.setString(1,"abcd");
csmt.registerOutParameter(2,Types.ARRAY); // Exception HERE
csmt.registerOutParameter(3,Types.INTEGER);

csmt.execute();

The program compiles fine, but when I run it, it throws SQLException at the
line marked HERE:
java.sql.SQLException: Parameter Type Conflict: sqlType=2003

IT DOES NOT EVEN REACH THE EXECUTE STATEMENT.

I then saw in
http://otn.oracle.com/software/tech/java/sqlj_jdbc/files/readme817.txt that
I should add nls_charset12.zip in my classpath as well, to be able to use
Collection Types. I did that, but no use :(

What am I doing wrong? Is there any alternative method to get multiple rows
from a SP?

Please help..
Thanks!
HC





Follow Ups:



Post a Followup


Name:
E-Mail:
Subject:

Message:


[ Follow Ups ] [ Post Followup ] [ Message Board ]