Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Passing an array to a Stored Procedure yield "Fail to convert to internal representation" (ORA-17059)

Re: Passing an array to a Stored Procedure yield "Fail to convert to internal representation" (ORA-17059)

From: D Rolfe <dwrolfeFRUITBAT_at_orindasoft.com>
Date: Mon, 15 Nov 2004 12:34:18 +0000
Message-ID: <4198A24A.4020603@orindasoft.com>


Soeren,

> Hi,
>
> I want to pass an array to a very simple Oracle SP, but when trying to
> create the ARRAY object a "Fail to convert to internal representation"
> SQL exception pops up. I think I've done everything allright, but
> Oracle thinks I didn't... ,-))
>
> The Oracle stuff look like that:
>
> -----------------------------------------------------------------------
> CREATE TYPE "DIVIDEND_DETAIL_OBJECT" AS OBJECT (
> "HV_DAY" NUMBER(8, 0),
> "EX_DAY" NUMBER(8, 0),
> "PAY_DAY" NUMBER(8, 0),
> "AMOUNT" FLOAT(64) );
>
> CREATE TYPE "DIVIDEND_DETAIL_COLLECTION" AS
> TABLE OF "DIVIDEND_DETAIL_OBJECT";
>
> CREATE OR REPLACE PROCEDURE "SP_UPDATE_INSERT_DIVIDEND_LIST"
> ( in_div_id IN int,
> in_div_version IN int,
> in_div_udl_id IN int,
> in_div_list IN dividend_detail_collection,
> in_check_version IN int,
> version_success OUT int,
> new_version OUT int,
> new_div_id OUT int )
>
> IS
> [...and so goes the SP...]
> -----------------------------------------------------------------------
>
>
> The relevant Java stuff looks like this:
> -----------------------------------------------------------------------
>
> public static class ddo {
> int HV_DAY;
> int EX_DAY;
> int PAY_DAY;
> float AMOUNT;
> };
>
> [...other stuff ommitted...]
> OracleCallableStatement cstmt = (OracleCallableStatement)
> oconn.prepareCall("{call
> curvesbeta.SP_UPDATE_INSERT_DIVIDEND_LIST(?,?,?,?,?,?,?,?)}");
> ArrayDescriptor aDesc = new
> ArrayDescriptor("DIVIDEND_DETAIL_COLLECTION", oconn);
> int size = 2;
> ddo[] elements = new ddo[size];
> elements[0] = new ddo();
> [...now setting the array content...]
> ARRAY array = new ARRAY(aDesc, oconn, elements);
>
> -----------------------------------------------------------------------
>
> The last line in the above code throws the Java exception. Can anybody
> shed some light on this? As from my understanding ddo is an exact
> representation of the oracle type DIVIDEND_DETAIL_OBJECT and elements
> is a java array of this "type", but Oracle claims there's an error -
> but what exactly?
>

Without seeing the code for the object 'ddo' it's hard to tell exactly what's going on here. Does your dividend detail object implement the ORAData and ORADataFactory factory interfaces? If not then unhappiness will ensue.

David Rolfe
Orinda Software
Dublin, Ireland Received on Mon Nov 15 2004 - 06:34:18 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US