| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> problems passing table of object to Java from PL/SQL
HiYa
I've been trying to pass a structure rather than simply an array of string to some Java, however I've been unsucessful. Can anyone suggest what I might be doing wrong?
I've made the following types
create or replace type array_of_persons as table of person;
PROCEDURE j_test_people (p_dummy IN strArray
, p_in IN array_of_persons
, p_out OUT strArray) AS
LANGUAGE JAVA NAME
BEGIN
people.EXTEND;
people(1) := person('Chris', 'Eastwood');
people.EXTEND;
people(2) := person('James', 'Cook');
people.EXTEND;
people(3) := person('Billy', 'Bragg');
people.EXTEND;
people(4) := person('Tommy', 'Emanuel');
cell.EXTEND;
cell(1) := 'yo there';
java_test.j_test_people( cell , people , returnData);
dbms_output.put_line('return data has '|| returnData.COUNT );
FOR i IN 1 .. returnData.COUNT LOOP
END LOOP; END;
public class paramPassingTest
{
public static void pass_person_array( oracle.sql.ARRAY p_dummy,
oracle.sql.ARRAY p_in,
oracle.sql.ARRAY[] p_out
) throws java.sql.SQLException
{
String[] stringArray = new String[6];
String[] dataRow;
Connection conn = new OracleDriver().defaultConnection();
ArrayDescriptor descriptor =
ArrayDescriptor.createDescriptor( p_dummy.getSQLTypeName(),
conn );
stringArray[0] = p_dummy.getSQLTypeName();
//EASTWOOC_DEV.STRARRAY
stringArray[1] = p_dummy.getBaseTypeName(); //VARCHAR
stringArray[2] = p_in.getSQLTypeName(); //EASTWOOC_DEV.ARRAY_OF_PERSONS
stringArray[3] = p_in.getBaseTypeName(); //EASTWOOC_DEV.PERSON
String[] values = (String[])p_in.getArray();
p_out[0] = new ARRAY( descriptor, conn, stringArray );
}
}
its here at the end where I'm falling down. I know that the parameter is getting in, and I'm able to get in my OUT parameter the SQLTypeName and BaseType, but I don't know how to access my data.
I know that if I was passing in a table of varchar2 I could use something like
String[] values = (String[])p_in.getArray();
but, I'm beginning to think that it won't support passing anything else.
help! Received on Tue Aug 17 2004 - 08:03:05 CDT
![]() |
![]() |