Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> JDBC / ref cursor and VARRAY

JDBC / ref cursor and VARRAY

From: kylix_seeker <none_at_nowhere.com>
Date: Mon, 08 Apr 2002 10:17:31 GMT
Message-ID: <Xns91EA734CF2A3Dkylixseeker@62.253.162.108>


Hello

I had some Java code connecting to a database that worked up until a recent upgrade to 9i. We upgraded the Oracle driver to the latest classes12.zip. The code is below - hoping someone can help. Basically, the procedure being called returns a ref cursor. One of the fields in the ref cursor is a VARRAY of numbers which are fetched using BigDecimal. This still works. The part I am having problem with is that another field contains a VARRAY of VARCHAR2 data. I used to bring this into a String ARRAY. This now fails.

// First section, prepares and makes the call
cstmt = dbConn.prepareCall("{ call map_details.obtain(?,?,?,?,?) }");

cstmt.setLong(1, Long.valueOf(var1).longValue());
cstmt.setInt(2, var2);
cstmt.setInt(3, var3);
cstmt.setInt(4, var3);
cstmt.registerOutParameter(5, OracleTypes.CURSOR);
cstmt.execute();

OracleResultSet rs = null;
rs = (OracleResultSet)cstmt.getObject(5);

// This still works

ARRAY array = rs.getARRAY(5);
BigDecimal[] values = (BigDecimal[]) array.getArray(); BigDecimal westTM = values[0];
BigDecimal southTM = values[1];
BigDecimal eastTM = values[2];
BigDecimal northTM = values[3];

// This now fails but used to work

         ARRAY array_i = rs.getARRAY(6);
         String[] values_i = (String[]) array_i.getArray();
         for (int j=0; j<values_i.length; j++)
         {
                 String value = values_i[j];
                 System.out.println(value+"s next im");
                 if ( j > 0 )
                         imageList = imageList + ", " + value;
                 else
                         imageList = imageList + "" + value;
         } // End of loop through ordinate array of imag


Thanks

Chris Received on Mon Apr 08 2002 - 05:17:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US