• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to retrieve array elements returned by an Oracle SP  RSS feed

 
Raj
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an Oracle SP that returns a Array.
Now, I am trying to retrieve the elements in that array using the following code snippet....but i am facing a java.lang.ClassCastException....
can somebody help me out with this???
i got this code from a tutorial......

cstmt1.registerOutParameter(4, OracleTypes.ARRAY,"PROPLIST");
cstmt1.executeUpdate();

ARRAY propValues = (ARRAY)cstmt1.getArray(4);

String[] values = (String[]) propValues.getArray();

for( int i = 0; i < values.length; i++ )
{
System.out.println( "row " + i + " = '" + values + "'" );
}
 
Paul Clapham
Sheriff
Posts: 22828
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So that means that "propValues.getArray()" doesn't return an array of Strings.

What does it return? Well, I have no idea. Maybe the Oracle documentation or the driver documentation tells you. But if I wanted to know, I would do something like this:
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!