Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting array of Oracle Objects

 
Prashanth menon
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am using CallableStatements . The Oracle object I have is testobjtype and the package is testpkg. How do I register the outParameter of a varray type? I am getting error when I create a ArrayDescriptor ...

The code is below.

OracleCallableStatement callableStatement = (OracleCallableStatement)
con.prepareCall ("{ ? = call TESTPKG.testf(?)}");

callableStatement.setString(2, "test");

Object elements[] = new Object[20];

ArrayDescriptor desc = ArrayDescriptor.createDescriptor("TYPE_VARRAY", con);
/*
I tried with this also
ArrayDescriptor desc = ArrayDescriptor.createDescriptor("testobjtype", con);
*/

ARRAY newArray = new ARRAY(desc, con, elements);
callableStatement.registerOutParameter(1, OracleTypes.ARRAY, "newArray");
callableStatement.execute();

ResultSet rs = (ResultSet)callableStatement.getObject (1);

ERROR:
SQLException java.sql.SQLException: invalid name pattern: TEST.TYPE_VARRAY
java.sql.SQLException: invalid name pattern: TEST.TYPE_VARRAY
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.oracore.OracleTypeADT.initMetadata(OracleTypeADT.java:424)
at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java:343)
at oracle.sql.ArrayDescriptor.initPickler(ArrayDescriptor.java:1002)
at oracle.sql.ArrayDescriptor.<init>(ArrayDescriptor.java:132)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:97)
at com.busch.wms.interfaces.TestVarray.main(TestVarray.java:75)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic