Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> stored procedure problem
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
![]() |
![]() |