Multidimensional Arrays in PL/SQL

I'm very familiar with single dimensional arrays such as this:
declare
      type year_type is table of number index by binary_integer;
      year_sales year_type;
      tot_sales   number;
begin
      year_sales(1990) := 34000;
      year_sales(1991) := 45000;
      year_sales(1992) := 43000;
      tot_sales := year_sales(1990) + year_sales(1991) +
year_sales(1992);
      dbms_output.put_line('Total sales: ' || tot_sales);
end;but I'd like to get a basic understanding of multi-dimensional arrays. As an example, if I have a "claim number" 123456 and two different "field numbers" 2471 and 2472 for that one claim, that contain values ('value1','value2'), could I store them in a multi-dimensional array? Logically, I would like the values to be store something like the following.
multi_array(123456)(2471) := 'value1';
multi_array(123456(2472) := 'value2'; Could someone point me in the right direction with this one with a simple example?
Thank you.

Simple example of using a collection of a collection to mimic a "multi-dimensional" array:
DECLARE
    TYPE varchar_tbl_t IS TABLE OF VARCHAR2(50) INDEX BY BINARY_INTEGER;
    TYPE multi_array_t IS TABLE OF VARCHAR_TBL_T INDEX BY BINARY_INTEGER;
    multi_array MULTI_ARRAY_T;
BEGIN
    multi_array(123456)(2471) := 'value1';
    multi_array(123456)(2472) := 'value2';
    multi_array(123457)(2473) := 'value3';
    multi_array(123458)(2474) := 'value4';
    -- Output Data
    FOR i in multi_array.FIRST .. multi_array.LAST
    LOOP
        FOR j in multi_array(i).FIRST .. multi_array(i).LAST
        LOOP
            dbms_output.put_line('multi_array('||i||')('||j||') = '||multi_array(i)(j));
        END LOOP;
    END LOOP;
END;Edited by: cmartin2 on Oct 28, 2010 9:50 AM

Similar Messages

  • MultiDimensional Array or what????

    Hi Guys
    I have created an xml document that has this structure for
    each child:
    <work>
    <client>Telstar Records</client>
    <titled>Stargate Music.co.uk</titled>
    <thumb>images/thumbs/stargate_sm.jpg</thumb>
    <description>They were an up and coming band, i was a
    designer with a passion for 3d, they met fell in love and a new
    site was born. All it took was four press shots, one promo and a
    lot of imagination</description>
    <images>
    <image>images/large/telstar_sg_01.jpg</image>
    <image>images/large/telstar_sg_02.jpg</image>
    <image>images/large/telstar_sg_03.jpg</image>
    </images>
    <link>
    http://www.4zero1.co.uk/backupsites/stargate/index.html</link>
    </work>
    I have succesfully created buttons and used an associative
    array to compile the info for each button, woooooo aren't i
    clever!!!! I have set up a path to the <images> node, but I
    am stumped as to how i can pull the information from the
    'workImages' variable in my getworkData() function below .
    I need your help, as i would like to create buttons of the
    childnodes named <image> in the xml, above you can see that
    if i was successful i would have three buttons. My problem is
    relating the information to the buttons and making the buttons
    appear. I am not using a for loop as i would like to animate each
    button using a scripted tween. as in the makeButtons() function.
    Do I need to create a multidimensional array? I have included
    my code below, please don't get too lost in it, i hope someone can
    fathom it for me and give me an answer. My associative array is in
    the function getworkData(); My function to create the 'image'
    buttons is called portfolioImageCreator();
    Many thanks
    Jim

    You could use a table of records or a record group. They both achieve similar results but with very different syntax. I am not sure if there is any difference in performance.
    Record groups are good for certain things like lists populated from the database because built-ins are provided for manipulating them. If you are going to do the manipulation programatically, I personally find the syntax for tables of records less cumbersome than record groups. Learning the syntax for tables of records is also likely to be more universally useful to you as they have various uses such as passing data between procedures.
    In your situation the table of records needs to exist throughout the forms session rather than just during the execution of a single pl/sql block. The way to do that is create a program unit which is a package header without a body. Declare the table in there and it can be used throughout the form.
    However, if you only ever want to keep 5 records, it would probably be easier just to have 5 ordinary items in a control block on the null canvas (or global variables). When you want to record your new action just do:
    :item5 := :item4;
    :item4 := :item3;
    :item3 := :item2;
    :item2 := :item1;
    :item1 := :new_stuff;
    You could even construct the above in a loop using
    copy(name_in('item'||i),'item'i+i)
    but with only 5 items to manipulate, is it worth the bother ?
    Whatever method you decide to use, you are not going to get anything simpler than 5 little assignment statements.

  • How to bind arrays to PL/SQL stored procedure using OCI?

    Hi,
    We are having problems trying to bind arrays to PL/SQL stored procedure using OCI. Here is the situation:
    - We have a stored procedure called "GetVEPFindTasks" with the following interface:
    PROCEDURE GetVEPFindTasks (
    p_ErrorCode OUT NUMBER,
    p_ErrorMsg OUT VARCHAR2,
    p_RowCount OUT NUMBER,
    p_VEPFindTasks OUT t_VEPFindTaskRecordTable,
    p_MaxTask IN NUMBER);
    t_VEPFindTaskRecordTable is a record with the following entries:
    TYPE t_VEPFindTaskRecord IS RECORD (
    RTCID NUMBER,
    TransNum NUMBER,
    TransTimestamp VARCHAR2(20),
    Pathname1 image_data.pathname%TYPE,
    Pathname2 image_data.pathname%TYPE,
    Pathname3 image_data.pathname%TYPE,
    OperatorID operator.id%TYPE);
    - Now, we are trying to call the stored procedure from C++ using OCI (in UNIX). The call that we use are: OCIBindByName and OCIBindArrayOfStruct to bind the parameters to the corresponding buffers. We bind all parameters in the interface by name. Now, we do bind the record's individual item by name (RTCID, TransNum, etc.), and not as a record. I don't know if this is going to work. Then, we use the bind handles of the binded record items (only record items such as RTCID, TransNum, and NOT error_code which is not part of the record) to bind the arrays (using OCIBindArrayOfStruct).
    All of the parameters that are binded as arrays are OUTPUT parameters. The rest are either INPUT or INPUT/OUTPUT parameters. Now, when we try to execute, OCI returns with an error "Invalid number or types of arguments" (or something to that sort... the number was something like ORA-06550). Please help...
    Is there any sample on how to use the OCIBindArrayOfStruct with PL/SQL stored procedures? The sample provided from Oracle is only for a straight SQL statement.
    Thank's for all your help.
    ** Dannil Chan **

    As you said:
    You have to pass in an array for every field and deconstruct/construct the record in the procedure. There is no support for record type or an array of records. Can you give me a example? I'am very urgently need it.
    thanks
    email: [email protected]

  • Updating array data in sql database

    HI,
    Im facing problems in updating array data in SQL database.
    As of now, i am able to write an "insert" query and insert array data in an image datatype field. Im using image datatype because the array size is very big(around 80,000 x and y values).
    Althoug inserting data is easy im unable to write a query to update this data.
    Referring to the help of SQL server and Labview database connectivity toolkit, i came across a method of accessing image datatype....using textpointers, which are 16 bit binary values and using the WRITETEXT function instead of the UPDATE function.
    but the problem im facing is that ive to pass the array as a 2d string array in the query as a result the updated array is retrieved in the form of a string a
    nd not as an array. how do I get over this problem?

    Hi Pavitra,
    I'm not very clear on how you have inserted the data into your application, but I do know that when you call the UPDATETEXT or WRITETEXT function you use the TEXTPOINTERS to point to the first location of a 1d array. So, depending on how you've stored the data, you may have problems updating your data if you're looking at it as a 1d array instead of how you originally formatted it. If you are able to successfully access the data as a 1d array, you can use the database variant to data type vi and pass in a string array constant for the data type. This will convert the variant datatype into whatever you specify. You may have to index the row and column of the variant (you receive a 2d array of variant) first before you convert. If possible, can yo
    u provide some more detail and maybe some example code of how you perform the insert and plan to do the update? I can probably give you a better solution if I know how you are formatting the data. Thanks!
    Jeremy L.
    National Instruments
    Jeremy L.
    National Instruments

  • How to pass a multidimensional array to an Oracle procedure?

    How can I pass a multidimensional array to oracle array?
    Thanx in anticipation,

    Look in to passing user defined type back and forth to Oracle. Any type that oracle supports, you can constract on the java side and send it across. Look into the SQLData class.

  • PL/SQL array passed to SQL IN

    Hi,
    I have a PL/SQL array which type is defined like this:
    create or replace type type_id_array as table of number(6, 3);
    then i create a variable and initilaize:
    var_1 type_id_array;
    var_1 := .....
    then i have a select statement.
    select * from table t where t.id in(var_1)
    That's it, i want to use the array in an SQL in. This seems not possible.
    Can you explain why? Any alternate solutions?
    Thanks

    user610868 wrote:
    That's it, i want to use the array in an SQL in. This seems not possible.
    Can you explain why? Any alternate solutions?SQL supports set commands specifically for arrays (in addition to the using the TABLE() method mentioned). For example:
    SQL> create or replace type TNumbers is table of number;
      2  /
    Type created.
    SQL>
    SQL> declare
      2          numList TNumbers;
      3          cnt     integer;
      4  begin
      5          numList := new TNumbers(1,2,3,4,5,6,7);
      6          select
      7                  count(*) into cnt
      8          from    user_objects
      9          where   TNumbers(object_id) member of numList;
    10          DBMS_OUTPUT.put_line( 'cnt='||cnt );
    11  end;
    12  /
    cnt=0
    PL/SQL procedure successfully completed.Obviously there are performance considerations when using arrays/collections in SQL. So before choosing a method, evaluate the performance.

  • Bindind data to multidimensional Array

    I have a multidimensional Array (3D). I have some fields which I want to bind to some TextInputs:
    model.creditosConsumoModel.literaturaCredito[i][j][k]
    And here's a example of the data binding:
    text="{(model.creditosConsumoModel.literaturaCredito[4][12][0] as Apartado).texto}"
    The problem is: When I do a: model.creditosConsumoModel.literaturaCredito = new Array and I define the Array again with new data everything gets blank (all the text Inputs) and I loss the information.
    Resume: It only works the first time, but not the rest of the times.
    Thanks and regards!!!

    @Pauland
    That's what I was thinking as it was an array of arrays.
    @quebequiano
    Generally, for something like this, I make a wrapper object and set the values on that so I don't have to deal with issues like this.  I'm not sure how architecturally sound it is, but it sounds like you are trying to take small pieces of data and prepare them for your view, in which case a wrapper/adapter would provide you with the benefits of databinding.
    P.S Does your name mean "Quebecian" in spanish ?

  • Array in PL/SQL

    Hi All
    Is that possible that we can use Arrays in PL/SQL.
    If yes, pls guide me how can we define dynamic array in pl/sql.
    Thanks & Regards
    Mani

    Hi,
    Yes it's possible.
    You'll find all the required info and samples, as usual, in TFM(click).
    Regards,
    Yoann.

  • Problems making windchill chart using multidimensional arrays

    Alright i am doing a program for my java class. The book doesnt tell me much and the teacher didnt either cause we had a midterm to take. Alright in this program i have to write a java program that produces a wind chill chart with temperatures from 50 to -50 degrees f in steps of 10 degrees, with wind speeds from 5 to 50mph, in steps of 5mph. The following formula may be useful.
    windchill= ((10.45+6.686112 * sqrt(windspeed)- .447041 * windspeed)/22.034)*(temperature- 91.4) + 91.4
    use for statements in your program and a function to calculate the wind chill factor at a given temperature and wind speed.
    I know im gonna have to use multidimensional arrays to do this problem, unless someone has an easier way to do it. I am really stuck. I have this so far.
    import javax.swing.*;
    public class lab7
    public static void main( String args[] )
    int a[][] = {{5,10,15,20,25,30,35,40,45,50},
    {-50,-40,-30,-20,-10,0,10,20,30,40,50}};
    System.exit(0);
    I am not even sure if that is correct but the major problem is how can i get the program to show a table with the temperature on the x coordinate at the top the wind speed on the y axis and then having the program use those arrays to calculate the windchill and put that in the table. I am really stuck and i was wondering if u guys could give me a little push in the right direction. The book doesnt say much so thats why im asking.
    Thank you everyone.

    I have no clue what i am doing right now. I am so confused it isnt even funny. I am trying something new to see what happens. The decimalformat didnt do anything for me. I have the numbers i just want to be able to put them into a chart. I wish my teacher would actually teach, and the book actually say how to do stuff.
    This is my program:
    import java.text.DecimalFormat;
    public class lab7
    DecimalFormat twoDigits = new DecimalFormat ("0.00");
    static private double windchill(double s, double t) { 
    return (((10.45 + 6.686112 * Math.sqrt(s) - .447041 * s)/(22.034))*(t-91.4) + 91.4);};
    static void print(double s, double t)
    {   System.out.print(" "+windchill(s, t));};
    static private void printRow(double s)
    { // the speed is assumed constant  
    for (double t= -50; t <= 50; t+= 10) // loop over the temperature values
    print(s, t); // print a row value
    System.out.println();};
    static private void printChart()
    {   for (double s= 5; s <= 50; s+= 5)      
    printRow(s);};
    public static void main(String args[])
    for (double t= -50; t <= 50; t+= 10) // loop over the temperature values
    {System.out.print( "   " + t);};
    System.out.println();
    System.out.println();
    for (double s= 5; s<=50; s+= 5)
    {System.out.println(s);};
    printChart();
    I am probably way off and this program is due tomorrow and i am going nuts. I tried to do it during the week and it didnt work out to well.
    Here is what it is outputting.
    C:\cis260>java lab7
    -50.0 -40.0 -30.0 -20.0 -10.0 0.0 10.0 20.0 30.0 40.0 50.
    0
    5.0
    10.0
    15.0
    20.0
    25.0
    30.0
    35.0
    40.0
    45.0
    50.0
    -57.26056937082865 -46.747092046159025 -36.233614721489374 -25.720137396819737
    -15.2066600721501 -4.6931827474804635 5.820294577189159 16.333771901858796 26.84
    7249226528433 37.36072655119807 47.87420387586771
    -82.65748711959239 -70.3479052865236 -58.03832345345484 -45.728741620386074 -33
    .41915978731731 -21.109577954248536 -8.799996121179774 3.5095857118890024 15.819
    167544957764 28.128749378026534 40.4383312110953
    -98.80774164293763 -85.35599188035366 -71.90424211776966 -58.452492355185655 -4
    5.00074259260168 -31.54899283001768 -18.097243067433695 -4.645493304849694 8.806
    256457734293 22.25800622031828 35.70975598290227
    -110.17157107350803 -95.91615586321751 -81.66074065292699 -67.40532544263644 -5
    3.14991023234592 -38.894495022055395 -24.639079811764873 -10.38366460147435 3.87
    17506088161713 18.127165819106693 32.38258102939722
    -118.4766111010257 -103.63385218298993 -88.79109326495416 -73.94833434691841 -5
    9.105575428882645 -44.262816510846875 -29.42005759281112 -14.57729867477535 0.26
    54602432604065 15.108219161296176 29.95097807933194
    -124.60889848734033 -109.33245587861754 -94.05601326989475 -78.77957066117196 -
    63.50312805244914 -48.22668544372635 -32.950242835003564 -17.67380022628076 -2.3
    973576175579723 12.87908499116483 28.15552759988762
    -129.09477971074705 -113.50108949075079 -97.90739927075452 -82.31370905075829 -
    66.72001883076203 -51.12632861076577 -35.53263839076952 -19.93894817077326 -4.34
    5257950777011 11.24843226921925 26.842122489215498
    -132.2771986196876 -116.45844341320333 -100.63968820671906 -84.82093300023479 -
    69.00217779375052 -53.18342258726625 -37.36466738078198 -21.545912174297698 -5.7
    27156967813428 10.09159823867084 25.91035344515511
    -134.39436482483956 -118.42588074953267 -102.45739667422575 -86.48891259891886
    -70.52042852361197 -54.55194444830505 -38.58346037299816 -22.614976297691257 -6.
    646492222384367 9.321991852922537 25.29047592822944
    -135.61971729379445 -119.56457462803812 -103.50943196228181 -87.45428929652547
    -71.39914663076914 -55.34400396501283 -39.288861299256496 -23.233718633500175 -7
    .178575967743839 8.876566698012482 24.931709363768803
    C:\cis260>
    All i want it to do is look like this: im just gonna make numbers in between just say that there is numbers in that whole thing. What am i missing. Thanks everyone so far for everything, i just need a little more and it should be done.
    -50 -40 -30 -20 -10 0 10 20 30 40 50
    5 65 44 55 78 4 45 etc etc etc
    10
    15
    20
    25
    30
    35
    40
    45
    50

  • Multidimensional Array in Indesign?

    Hey guys,
    normally in javascript I can just create a multidimensional array like so:
    myArray = [ [] ];
    and then assign values like this:
    myArray[0][0] = 'item1';
    In extendscript I get the error "undefined is not an object". Is there something I forgot about, or is this just not possible in Indesign?

    I found out it was another problem. The code works like this, but you need to define in the beginning how many arrays are in the array. Otherwise it will throw the "undefined" error.
    points = new Array(object.paths.length);
    for(i = 0 ; i<object.paths.length; i++){
        points[i] = new Array();
    This code works now, as the length of the array is exactly the length you need. And for every key you add another array, to create your two dimensional array on every key.

  • Multidimensional array and chars

    Hi again,
    My apologies in advance if i can't word my question that well, i will try and be as clear and succinct as possible and hopefully for this newbie you can apprehend what i'm trying to figure out if i come up short.
    I'm trying to write a rather large control statement with a while loop and several nested ifs inside it that ultimately returns a single character after all is said and done, and then continually concatenates that character to a string which will eventually be output to a file. The part i'm stuck at is after i've changed the two letter characters into their ASCII values. I need to make the program take those two ASCII values and use them as a reference to a character in a multidimensional array of alphabetic characters, and then that character will be what is returned at the end.
    Here's the method, thanks in advance for your time.
    public String encode( String cipherKey )
            String textToEncode = input.next();
            String encodedText = " ";
            cipherKey = cipherKey.toUpperCase();
            textToEncode = textToEncode.toUpperCase();
            openFiles();
            int numberOfChars = textToEncode.length();
            int cipherPos = 0;
            int cipherLength = cipherKey.length();
            while (input.hasNext())
                for ( int count = 0; count < numberOfChars; count++ )
                    if (Character.isLetter(textToEncode.charAt(count)))
                        cipherPos %= cipherLength;
                        int xChar = (int) textToEncode.charAt(cipherPos);
                        int yChar = (int) textToEncode.charAt(count);
                        xChar -= 65;
                        yChar -= 65;
                        if ((xChar >= 0) && (xChar <= 25))
                            if ((yChar >= 0) && (yChar <= 25))
                        return ' ';
                     encodedText = encodedText +
        return encodedText; 
        }As you can see towards the end there are some incomplete statements where i became lost.

    its there, i couldnt c&p the whole program because it went over my character limit. Yeah it did compile but couldn't invoke my encode method without a NullPointerException.
    Here are the other methods in the class....
        public String setSource( String in )
            source = in;
            return source;
         Sets the value of the output file
         * @param out A <code>String</code> value representng name of output file.
         * @see #setSource
        public String setDestination( String out )
            destination = out;
            return destination;
         * Method to open both input and output files, and to test for exceptions
         * @see #encode
         * @see #decode
        private void openFiles()
        File inputFile = new File(source);  //Creates new file object from source file
        File outputFile = new File(destination);  //Creates new file object from destination file
            /* Tests whether input file exists and if so enables the Scanner
             * to read the data in from the source file. Catches SecurityException and
             * FileNotFoundException amd prints appropriate messages to user.
            if (inputFile.exists())
                try
                    input = new Scanner( new File( source ) );
                    FileReader reader = new FileReader(inputFile);
                    BufferedReader BufferIn = new BufferedReader(reader);
                catch ( SecurityException securityException )
                    System.err.println("You do not have read access to this file.");
                    System.exit( 1 );
                catch ( FileNotFoundException filesNotFoundException )
                    System.err.println("Error: File does not exist.");
                    System.exit( 1 );         
            /* Tests whether output file exists and if it does enables Formatter
             * to write encoded output to file. Catches SecurityException and
             * FileNotFoundException and prints appropriate message to user.
            if (outputFile.exists())
                try
                    output = new Formatter( new File( destination ) );
                catch ( SecurityException securityException )
                    System.err.println("You do not have write access to this file.");
                    System.exit( 1 );
                catch ( FileNotFoundException filesNotFoundException )
                    System.err.println("Error: File does not exist.");
                    System.exit( 1 );
         * Closes both input and output files after output file has been written
         * to.
         * @see #openFiles
        private void closeFiles()
            if ( output != null )
                input.close();
                output.close();
        }Edited by: fearofsoftware on Apr 17, 2009 8:35 PM

  • Multidimensional Array in TableView

    I'm working on a program that stores some variables in a multidimensional array (NSMutableArrays in a NSMutableArray). My array looks something like this:
    hopSoort
    hopDosering
    alfaZuur
    kookTijd
    Saaz (CZ)
    16
    3.2
    60
    EK Goldings
    20
    5.6
    60
    I've made a class with two methods (for adding rows, and for doing the math). I'm just testing the logic in a command line application and all seems to work fine. But eventually I want to make a Cocoa app and use the TableView to add/edit/delete rows.
    Is this the correct way to go? If desired I can post some code.

    I fixed it by using a NSMutableArray with a NSMutableDictionary objects as childs. Now I need to convert my other classes to use NSMutableDictionaries instead of NSMutableArrays.

  • Multidimensional array in jquery class/object

    I'm trying to get into javascript and jquery for a hobby project of mine. Now I've used the last 4 hours trying to find a guide on how to create class objects that can contain the following information
    Identification : id
    Group : group
    Persons : array(firstname : name, lastname : name)
    Anyone know of a tutorial that can show me how to do this?
    I found this page where I can see that an object can contain an array, but it doesn't state whether it is possible to use a multidimensional array.
    And this page just describes the object with normal values.
    Any pointers in the right direction are appreciated.

    There are no classes in JavaScript. It uses a different style of objects and what you found is indeed what you need.
    Well, it might help to think about it as a dynamic, runtime-modifiable object system. An Object is not described by class, but by instructions for its creation.
    Here you have your object. Note that you can use variables everywhere.
    var id = 123;
    var test = {"Identification": id,
    "Group": "users",
    "Persons": [{"firstname":"john", "lastname":"doe"},{"firstname":"jane","lastname":"doe"}]
    This is identical to the following code. (The first one is a lot nicer, though.)
    var id = 123;
    var test = new Object();
    test.Identification = id;
    test["Group"] = "users;
    test.Persons = new Array();
    test.Persons.push({"lastname":"doe","lastname":"john"});
    test.Persons.push({"lastname":"doe","lastname":"jane"});
    As you can see, you can dynamically add new properties to an object. You can use both the dot-syntax (object.property) and the hash syntax (object["property"]) in JavaScript.

  • How I save a 1D-folat array to MS Sql Server"s image field?

    How I save a 1D-folat array to MS Sql Server"s image field?
    I try.
    First all I flat the array.
    Then I insert the flated string into the table.It 's OK.
    I read it from the table.
    There is a error.
    The field data is empty.
    why?
    Attachments:
    01.vi ‏51 KB

    TimeWaveZero wrote:
    Just use the Array to spreadsheet string and insert the array, then retrieve with Spreadsheet string to array. 
    This is a lossy conversion that does not allow recovery of the identical DBL array due to limitations in the decimal formatting. Not the same! It is also significantly less efficient.
    LabVIEW Champion . Do more with less code and in less time .

  • JNI multidimensional Array and OpenCV

    Hello everybody,
    my first post, so lets go..
    At the moment I am writing my thesis in the filed of automatic image classification. The project is written in Java, but I wanna use the OpenCV library from Intel (http://sourceforge.net/projects/opencvlibrary/) for facedetection.
    So far I managed to call the native method from Java. What I do I parse the path of the image to be analyzed as a string to my C++ programm. The faces are being detected and written into a so called CvSeq (http://www.comp.leeds.ac.uk/vision/opencv/opencvref_cxcore.htm#cxcore_ds_sequences) which holds the coordinates of the rectangles surrounding the found faces. Until now I can only call cvSeq->total which gives me the total number of faces as ints. That integer I return to my java api.
    What I don't know is, how to return a multidimensional array (2 dimensions) where the first dim contains the path as a string to the file and the second dimension 3 integers for x,y coordinates and the lenght of each rectangle.
    Or better, I might know how to return that Array, but not how to create it.
    I know this is somewht OpenCV specific, but maybe someone knows anything. Any little help would be greatly appreciated. Thanks a lot!!!!
    Regards
    Carsten
    attached: JNI source code
    /////////////////////////////////////////// source code ///////////////////////////////////////////////
    #include "cv.h"
    #include "highgui.h"
    #include "cxcore.h"
    #include "cxtypes.h"
    #include "cvaux.h"
    #include "org_kimm_media_image_data_JNIOpenCV.h"
    #include <stdio.h>
    JNIEXPORT jint JNICALL
    Java_org_kimm_media_image_data_JNIOpenCV_getFaces(JNIEnv *env, jobject object, jstring path)
    //declarations
    CvHaarClassifierCascade *pCascade = 0;
    CvMemStorage *pStorage = 0;
    CvSeq *pFaceRectSeq;
    int scale=1;
    jobjectArray recPoints;
    const char *str = env->GetStringUTFChars(path, 0);
    //initializations
    IplImage* pInpImg = cvLoadImage(str, CV_LOAD_IMAGE_COLOR);
    IplImage* small_image = pInpImg;
    pStorage = cvCreateMemStorage(0);
    pCascade = (CvHaarClassifierCascade *)cvLoad
         (("C:/OpenCV/data/haarcascades/haarcascade_frontalface_default.xml"),0, 0, 0 );
    //validaste that everything initilized properly
    if( !pInpImg || !pStorage || !pCascade)
         printf("Initialization failed: %s \n",
              (!pInpImg) ? "didn't load image file" :
              (!pCascade) ? "didn't load Haar Cascade --"
                   "make sure Path is correct" :
              "failed to allocate memory for data storage");
         exit(-1);
    //performance boost through reducing image size by factor 2          
              small_image = cvCreateImage( cvSize(pInpImg->width/2,pInpImg->height/2), IPL_DEPTH_8U, 3 );
    cvPyrDown( pInpImg, small_image, CV_GAUSSIAN_5x5 );
    scale = 2;
    //detect faces in image
    pFaceRectSeq = cvHaarDetectObjects(small_image, pCascade, pStorage,
                                            1.1,                                        //increase search scale by 10% each pass
                                            6,                                        //drop group of fewer than three detections
                                            CV_HAAR_DO_CANNY_PRUNING,          //skip regions unlikely to contain faces
                                                 cvSize(50,50));                         //use XML default for smallest search scale
    //initialize array for location of the faces (HERE IS WHERE I GET INTO TROUBLE!!!!!)
    int x = pFaceRectSeq->total;
    jclass intArrCls = env->FindClass ( "[I" ) ;
    recPoints = env->NewObjectArray ( x, intArrCls, NULL ) ;
    //for(int j = 0; j <= x; j++) {
    //   recPoints[j] = (jintArray)env->NewIntArray(3);
    for(int i=0;i<(pFaceRectSeq ? pFaceRectSeq->total:0); i++)
                                       CvRect* r = (CvRect*)cvGetSeqElem(pFaceRectSeq, i);
                                       CvPoint pt1 = {(r->x)*scale, (r->y)*scale};
                                       CvPoint pt2 = {(r->x + r->width)*scale, (r->y + r->height)*scale};
    //env->SetObjectArrayElement(recPoints,i, pt1.x);
    return pFaceRectSeq->total;
    }

    Any Java array you can consider like one-dimensional array of arrays n-1 dimension. For example, you have a 3 dim. array of objects:
    Object[][][] arr = new Object[1][2][6]; It can be considered as a set of one-dimensional arrays:
    ==========================================
    |  dim   |           Type
    ==========================================
      0          1 element, an array of type �[[Ljava/lang/Object;�
      1          1 x 2 elements , an arrays of type �[Ljava/lang/Object;�
    So you can convert three-dimensional array to one-dimensional array like in C++:
    |�[Ljava/lang/Object;� | �[Ljava/lang/Object;� | �[Ljava/lang/Object;�
         6 objects                 6 objects                 6 objects

Maybe you are looking for