Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

varrays and preparedstatements - Java/Oracle

1 view
Skip to first unread message

Vara

unread,
Oct 18, 2002, 6:37:04 AM10/18/02
to
Hi.

I am using PreparedStatements (mandatory as per project standards).
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 ...

Here is the code:

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:
SYS.TYPE_VARRAY
java.sql.SQLException: invalid name pattern: SYS.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)



Any suggestions/solutions would help me.

Thanks in advance,

Vara

Björn Andersson

unread,
Oct 18, 2002, 9:32:23 AM10/18/02
to

"Vara" wrote...

> I am using PreparedStatements (mandatory as per project standards).
> 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 ...

[snip]

> ArrayDescriptor desc =
> ArrayDescriptor.createDescriptor("TYPE_VARRAY", con);

What you write here should be the name of your *predefined* type in the
Oracle-database, i.e.:

TYPE MYCALENDAR AS VARRAY (365) OF DATE;

Then you use that name to create an ArrayDescriptor:

ArrayDescriptor desc =
ArrayDescriptor.createDescriptor("MYCALENDAR", con);

--
Bjorn A


0 new messages