This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to send array as INPUT parameters from java code to a oracle9i Stored Procedure

 
Debu Das
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using oracle9i.

I am using a jdbc code which sends sequence of numbers in Object[].
But I am getting some kind of provider exception.
This stored procdeure is needed for some batch updation.

Exception :

Caused by: java.lang.ClassCastException: java.lang.Object
at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:2075)
at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:2099)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.setObject(WSJdbcPreparedStatement.java:1088)


1.CREATE TYPE LIST_PORT_NOS AS VARRAY (5) OF NUMBER(5,0)
// Used for Storing the request and response port numbers

2. This is the SP which will be used to create a Profile Link [ 1st Entry point]
CREATE OR REPLACE PROCEDURE SP_MTP_CREATE_PROFILE
(
reqPortNOList IN LIST_PORT_NOS, //numbers sent as Object[] from java
resPortNOList IN LIST_PORT_NOS, //numbers sent as Object[]
)
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Debu,
Here is an example:

http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/varray/index.html

and more here:

http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/jdbc20/jdbc20.html

I'm curious, how did you arrive at this code, if you didn't see an example of how to do it, previously?

Good Luck,
Avi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic