Unix Technical Forum

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

This is a discussion on Passing an array to a Stored Procedure yield "Fail to convert to internal representation" (ORA-17059) within the Oracle Database forums, part of the Database Server Software category; --> Hi, I want to pass an array to a very simple Oracle SP, but when trying to create the ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-24-2008, 08:54 AM
Soeren Gerlach
 
Posts: n/a
Default Passing an array to a Stored Procedure yield "Fail to convert to internal representation" (ORA-17059)

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?


Any help is greatly appreciated ,-)

Soeren Gerlach
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-24-2008, 08:57 AM
D Rolfe
 
Posts: n/a
Default Re: Passing an array to a Stored Procedure yield "Fail to convertto internal representation" (ORA-17059)

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:13 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com