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

Home -> Community -> Usenet -> c.d.o.misc -> stored procedure problem

stored procedure problem

From: Roy Ambrose <roy_at_ambroser.freeserve.co.uk>
Date: Tue, 17 Aug 1999 10:40:36 +0100
Message-ID: <7pbacv$h6m$1@news6.svr.pol.co.uk>


I am trying to pass a custom Java object as a parameter to a stored procedure and am experiencing problems. I make the following stored procedure call:

public void saveUser( UserProfile profile ) {
  OracleCallableStatement cstmt =
OracleCallableStatement)conn.prepareCall( "{call save_user(?)}" );   cstmt.setCustomDatum( 1, profile );
  cstmt.execute();
....

where UserProfile is my java class which implements CustomDatum and CustomDatumFactory. It has the 2 following member variables:

java.sql.Date
mypackage.User

The class mypackage.User also implements CustomDatum and CustomDatumFactory.

In UserProfile I am unsure of the implementation of the toDatum(..) function (as required by the CustomDatum interface). I have tried 2 different approaches as follows:

public Datum toDatum( OracleConnection c ) throws SQLException {
  StructDescriptor sd = StructDescriptor.createDescriptor( "FIN.USERPROFILE_OBJTYP", c );   Object [] attributes = { m_dateCreated, m_user.toDatum(c) };   return new STRUCT( sd, c, attributes ); ******
}

AND public Datum toDatum( OracleConnection c ) throws SQLException {
  StructDescriptor sd = StructDescriptor.createDescriptor( "FIN.USERPROFILE_OBJTYP", c );   Object [] attributes = { m_dateCreated, m_user };   return new STRUCT( sd, c, attributes ); ******
}

both of these throw an SQL exception saying "Fail to convert to internal representation" at the line marked with an asterix.

VERY stuck on this, so any help is greatly appreciated. Thanks in advance Received on Tue Aug 17 1999 - 04:40:36 CDT

Original text of this message

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