aspose file tools*
The moose likes JDBC and the fly likes How to send array as INPUT parameters from java code to a oracle9i Stored Procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to send array as INPUT parameters from java code to a oracle9i Stored Procedure" Watch "How to send array as INPUT parameters from java code to a oracle9i Stored Procedure" New topic
Author

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

Debu Das
Greenhorn

Joined: Feb 22, 2006
Posts: 2
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

Joined: Oct 11, 2000
Posts: 1135

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.
 
Don't get me started about those stupid light bulbs.
 
subject: How to send array as INPUT parameters from java code to a oracle9i Stored Procedure