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 -> varray descriptor in java - invalid name pattern - arg!!!

varray descriptor in java - invalid name pattern - arg!!!

From: kirstie <kmclatchie_at_rogers.com>
Date: 22 Aug 2002 21:41:00 -0700
Message-ID: <3e72b6d0.0208222041.7f13b9db@posting.google.com>


I am desperately trying to use a VARRAY to insert multiple records to two tables within the same stored procedure call.

oracle 8.1.7 + java 3.0.2

I am trying the code below (found online) The stored procedure exists and is valid, the db connection is fine too.
I get a runtime error --> "invalid name pattern: <schema>.number_varray"

Does anyone know why??????? ARG!!

public void testVARRAY() throws SQLException{

// Get a connection from the connection pool DatabaseManager dbmanager = DatabaseManager.getInstance(); Connection con = null;
CallableStatement cstmt = null;

try {

 con = (dbmanager.getConnectionPool()).getConnection();  Statement s = con.createStatement();
 s.execute("CREATE TYPE number_varray AS VARRAY(10) OF NUMBER(12,2)");

// Create an oracle.sql.ARRAY object to hold the values
 oracle.sql.ArrayDescriptor arrayDesc =

           oracle.sql.ArrayDescriptor.createDescriptor("number_varray", con);
 int arrayValues[] = {34, 234, 432};
 String model = "KIRSTIE";
 oracle.sql.ARRAY array = new oracle.sql.ARRAY(arrayDesc, con, arrayValues);

// Create a prepared statement for insertion of varray elements to
table rows
 cstmt = con.prepareCall("{call sy_htproducts.p_test(?,?)}");

// Set the values to insert

 ((oracle.jdbc.driver.OracleCallableStatement)cstmt).setARRAY(2, array);
 ((oracle.jdbc.driver.OracleCallableStatement)cstmt).setString(1, model);

 cstmt.execute();

} catch (SQLException e) {
 System.out.println("test db error on varray = " + e.getMessage()); }
} Received on Thu Aug 22 2002 - 23:41:00 CDT

Original text of this message

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