Oracle - 2D Array of integers

From: Manuel DESLIS (manuel.deslis_at_mail.com)
Date: 11/10/04


Date: 10 Nov 2004 03:08:26 -0800

Hi there

I try to store in a table (Oracle 9i) a matrix of integers, ie a 2D
array of integers.

And I can't make it work.

Here si my code :

// I have already done this on my data base :
// CREATE TYPE VECTOR AS VARRAY(10) OF NUMBER(10, 0)
// CREATE TYPE MATRIX AS VARRAY(10) OF VECTOR

// create 2 descriptors : vector and matrix
ArrayDescriptor descVector =
ArrayDescriptor.createDescriptor("VECTOR", connection);
ArrayDescriptor descMatrix =
ArrayDescriptor.createDescriptor("MATRIX", connection);

// create matrix
double[] line1 = {15, 25, 35};
ARRAY arrayLine1 = new ARRAY(descVector, connection, line1);
double[] line2 = {17, 27, 37};
ARRAY arrayLine2 = new ARRAY(descVector, connection, line2);
Object matrix[] = {arrayLine1, arrayLine2};
ARRAY arrayMatrix = new ARRAY(descMatrix, connection, matrix);

// insert the matrix
PreparedStatement ps = connection.prepareStatement("INSERT INTO
MY_TABLE VALUES (?)");
((OraclePreparedStatement) ps).setARRAY(1, arrayMatrix);
ps.execute();

Unfortunately, this doesn't work.
Anyone has a better idea ?

Thanks for your help, bye.

Manuel Deslis



Relevant Pages

  • Re: OpenNETCF SetWirelessSettings
    ... should get the same thing as when you enter that string in the UI. ... the ActiveSync connection. ... Encoding.Unicode.GetBytesto create a byte array, ... where WEPKey is my 8 character ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Implementing a DataReader : where to store the result from DB ?
    ... an array of array of objects seems to lead to unnecessary type ... Datatables are headless and don't have anything to do with a provider nor do ... open connection after you are done filling ... the same as using a DataReader in general. ...
    (microsoft.public.dotnet.framework.adonet)
  • array hp 1000, suse and 2 channels
    ... i was checking if it is compatibile with suse 9. ... the array has to channels, each connected to its san switch. ... and from each san switch there is a separate connection to the host. ... removing any of the cables causes "one array" failure, ...
    (comp.os.linux.hardware)
  • Re: Scalable tcp server
    ... poll too much). ... complete picture of who is connected to the server. ... "normally", one would just use an array, ... the wrt this connection. ...
    (comp.unix.programmer)
  • Wrapper for ADOdb_lite -- best way to do it?
    ... The first creates the ADO object and manages the database connection ... preparing a statement that matches the array keys to the table columns. ... I do this by making the ADO object a global. ... # SQL Query ...
    (comp.lang.php)