Home » Developer & Programmer » JDeveloper, Java & XML » return strings from PL/SQL
return strings from PL/SQL [message #92096] Tue, 09 March 2004 06:13 Go to next message
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...
}
Re: return strings from PL/SQL [message #92108 is a reply to message #92096] Thu, 11 March 2004 01:32 Go to previous messageGo to next message
Magnar Johannessen
Messages: 12
Registered: February 2004
Junior Member
Have You tried: System.out.println(voanListItem[[2]].toString());
Re: return strings from PL/SQL [message #92111 is a reply to message #92108] Fri, 12 March 2004 05:01 Go to previous message
rudi
Messages: 8
Registered: March 2003
Junior Member
thanks for answer,
will try it.

regards,
rudi
Previous Topic: JDBC CALL IN OUT REF CURSOR PARAMETER
Next Topic: ProductOrder.jar
Goto Forum:
  


Current Time: Tue Nov 26 03:12:27 CST 2024