Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] How to Call a procedure which have nested record type?

We try to call a procedure as follow,
PROCEDURE procedure_record_call_nest(
			input IN test_rec,
			output OUT test_rec)
The procedure has two arguments of 'test_rec' as follow
  TYPE test_nest_rec IS RECORD (
  			value01 varchar2(10),
  			value02 number);
  TYPE test_rec IS RECORD (
  			column01 varchar2(10),
  			column02 number,
  			nest01 test_nest_rec);
And, we try to call the procedure with follow code
        PLSQLrecord recordNest = new PLSQLrecord();
        recordNest.setTypeName("test_pkg.test_nest_rec");
        recordNest.setJavaType(TestNestRecDTO.class);
        recordNest.addField("value01", JDBCTypes.VARCHAR_TYPE);
        recordNest.addField("value02", JDBCTypes.NUMERIC_TYPE);

        PLSQLrecord record = new PLSQLrecord();
        record.setTypeName("test_pkg.test_rec");
        record.setJavaType(TestRecDTO.class);
        record.addField("column01", JDBCTypes.VARCHAR_TYPE);
        record.addField("column02", JDBCTypes.NUMERIC_TYPE);
        record.addField("nest01", recordNest);

        PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
        call.setProcedureName("test_pkg.procedure_record_call_nest");
        call.addNamedArgument("input", record);
        call.addNamedOutputArgument("output", record);
        DataReadQuery query = new DataReadQuery();
        query.addArgument("column01");
        query.addArgument("column02");
        query.addArgument("nest01");
        query.setCall(call);
        query.setResultType(DataReadQuery.ARRAY);
        List attributes = new ArrayList();
        attributes.add("tESt");
        attributes.add(1);
        List nestbutes = new ArrayList();
        nestbutes.add("TesT");
        nestbutes.add(1);
        attributes.add(nestbutes);
        List returnObject = (List)JpaHelper.getEntityManager(em).getActiveSession().executeQuery(query, attributes);
However we faced some error:
Caused by: oracle.oc4j.rmi.OracleRemoteException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: 列の型が無効です。
Error Code: 17004
Call: 
DECLARE
  input_TARGET xxpoc_test_pkg.test003_rec;
  output_TARGET xxpoc_test_pkg.test003_rec;
BEGIN
  input_TARGET.column01 := :1;
  input_TARGET.column02 := :2;
  input_TARGET.nest01 := :3;
  xxpoc_test_pkg.procedure_record_call_nest(input=>input_TARGET, output=>output_TARGET);
  :4 := output_TARGET.column01;
  :5 := output_TARGET.column02;
  :6 := output_TARGET.nest01;
END;
  bind => [:1 => tESt, :2 => 1, , , column01 => :4, column02 => :5, , ]
How can I do this? Sorry for my poor english. best regards

View this message in context: How to Call a procedure which have nested record type?
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

Back to the top