return strings from PL/SQL [message #92096] |
Tue, 09 March 2004 06:13 |
rudi
Messages: 8 Registered: March 2003
|
Junior Member |
|
|
Hi!
I have a serious propblem getting strings to java via jdbc from a PL/SQL. The return value is a VARRAY of user defined types. The VARCHAR2 values will be display in my java application like this: 0x30304565.... . What I am doing wrong?
Here is my code:
the head of my PL/SQL:
create or replace procedure LVEF_VOAN_QUERY(
start_offset IN number,
main_sql IN varchar2,
voan OUT lvef_voan_array)
the types:
create or replace type LVEF_VOAN_TYPE as object
(
HP number(2),
HH number(2),
ANSATZ varchar2(6),
POST varchar2(4)
);
create or replace type LVEF_VOAN_ARRAY is varray(20) of LVEF_VOAN_TYPE;
the java sourcecode:
cstmt = (OracleCallableStatement)connection.prepareCall("{call LVEF_VOAN_QUERY(?, ? ,?)}");
cstmt.setInt(1, (page - 1) * pageSize);
cstmt.setString(2, mainSql);
cstmt.registerOutParameter(3, OracleTypes.ARRAY, "LVEF_VOAN_ARRAY");
cstmt.executeUpdate();
Object[[]] voanList = (Object[[]])cstmt.getArray(3).getArray();
ArrayList result = new ArrayList();
Object[[]] voanListItem = null;
for(int i=0; i<voanList.length; i++)
{
voanListItem = ((Struct)voanList[[i]]).getAttributes();
System.out.println(voanListItem[[2]]);
// this return the string like 0x303045...
}
|
|
|
|
|