Initialize 2 dimensions arrays

Hi everybody.
Im using Oracle 11g, on Linux Centos.
My problem is with 2 dimensions array.
I have defined a type in the database in this way :
create or replace
TYPE ARRAY_N_12 is varray(12) of number;
Now I try to do the next :
create or replace
procedure PRUEBA_INDEX as
  type xyzp is table of array_n_12 index by varchar2(5);
    XX xyzp ;
  I number;
  Z number;
begin
   for I in -1 .. 100
   LOOP
   for Z in 1 .. 12
   LOOP
     XX(I)(Z) := i;
   end LOOP;
   end LOOP;
  and follow other commands.
When I compile this it do it without errors. But when I try to run it it say me error :
ORA-06531 , not initialized recompilation.
I understand that I need initialized the array. But I dont find the way.
If I do the next :
xx xyzp := xyzp(); It say me no valid in this context.
so I have been trying another ways but I dont find.
Can anybody help me with this?.
Thanks in advanced & regards.

Mixing VARRAY and INDEX BY collection types doesn't make this any easier to follow.
FOR i IN -1 .. 100 LOOP
   -- initialise element
   xx(i) := array_n_12();
   FOR z IN 1 .. 12 LOOP
      -- extend element
      xx(i).extend;
      -- assign element
      xx(i)(z) := i;
   END LOOP;
END LOOP;

Similar Messages

  • Initializi​ng arrays

    Hello!
    I'm doing a program which works with arrays. I use initialize block arrays to create them. But it depends on other variables the dimension of these arrays. If I want to change the length of a dimension I wire a variable to the block, but I have no idea what can I wire to the block to modify the number of dimensions....it cannot be modify when the program is running?? How I have to do modify the number of dimensions depends on a variable?
    Thank you in advance!
    Larson

    The initialize array function is a growable function, that is it changes the function inputs by dragging the dimensions not programatically.  There is a work around, you can use a case structure to call different versions of the function.  This will work but will only for a finite number of cases.  The other way is to initialize a multidimensional array as a single dimension and then pass it to the resize array function, i.e initialize ARRAY[i*j*k] and resize to ARRAY[i][j][k].  This is a little unusual to deal with arrays which change at runtime.  The final approach it to write polymorphic functions to handle the different cases, again you will not have full dynamic run-time handling of all possible cases but can handle a few cases easily.
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • How can i declare 2 or more dimension array as function parameter???

    I am new to Objective-C and Cocoa. and now I have a problem.
    I want to send 2 dimension array to function but it cannot compile the error is "array type has incomplete element type" Please help me
    This is my Interface
    + (void) reValueInArray: (int[][] ) labelValue replaceValue: (int) oldValue withValue: (int) newValue;
    and one more question
    How can i get length of array
    1. array that declare as array at first (int a[5] for example)
    2. array that declare as pointer at first (int a* for example)
    Thank you Very much

    Satake wrote:
    a 2 dimension array is just an array of arrays correct?
    No. It isn't.
    so it'd be something like
    - (void)arrayManipulator:(NSArray *)aTwoDimensionArray;
    You're mixing metaphors. The original poster isn't using NSArray, but, rather, C arrays.
    + (void) reValueInArray: (int[][] ) labelValue replaceValue: (int) oldValue withValue: (int) newValue;
    In C, a multi-dimensional array is just one big, single-dimensioned array that uses fixed sizes for all but one of the component arrays to find a particular element. That means that you can't ever do something like:
    There are several workarounds.
    1) Use NSArray, as suggested in the first reply. That will solve this problem and lots more. With NSArray, you really an have arrays inside of arrays.
    2) Treat the array as just a plain old pointer in the function signature, then cast it back to the properly dimensioned array.
    3) Create a true array of arrays in C, using dynamic allocation. More trouble than it's worth.
    4...N) Other options that are probably more trouble than they're worth.

  • How do I initialize an array after getting xml data via httpservice?

    I am having a problem trying to initialize an array with data from an external xml file obtained via httpservice.  Any help/direction would be much appreciated.  I am using Flex 4 (Flash Builder 4).
    Here is my xml file (partial):
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Root>
        <Row>
            <icdcodedanddesc>00 PROCEDURES AND INTERVENT</icdcodedanddesc>
        </Row>
        <Row>
            <icdcodedanddesc>00.0 THERAPEUTIC ULTRASOUND</icdcodedanddesc>
        </Row>
        <Row>
            <icdcodedanddesc>00.01 THERAPEUTIC US VESSELS H</icdcodedanddesc>
        </Row>
        <Row>
            <icdcodedanddesc>00.02 THERAPEUTIC ULTRASOUND O</icdcodedanddesc>
        </Row>
    </Root>
    Here is my http service call:
    <s:HTTPService id="icdcodeservice" url="ICD9V2MergeNumAndDescNotAllCodes.xml"
                           result="icdcodesService_resultHandler(event)" showBusyCursor="true"  />
    (I have tried resultFormat using object, array, xml).
    I am using this following Tour de Flex example as the base -http://www.adobe.com/devnet-archive/flex/tourdeflex/web/#docIndex=0;illustIndex=1;sampleId =70500
    and updating it with the httpservice call and result handler.  But I cannot get the data to appear - I get [object Object] instead.  In my result handler code  I use "icdcodesar = new Array(event.result.Root.Row);"  and then "icdcodesar.refresh();".
    The key question is: How to I get data from an external xml file into an array without getting [object Object] when referencing the array entries.  Thanks much!
    (Tour de Flex example at http://www.adobe.com/devnet-archive/flex/tourdeflex/web/#docIndex=0;illustIndex=1;sampleId =70500  follows)
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   xmlns:local="*"
                   skinClass="TDFGradientBackgroundSkin"
                   viewSourceURL="srcview/index.html">
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            @namespace local "*";
            s|Label {
                color: #000000;
        </fx:Style>
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                private var names:ArrayCollection = new ArrayCollection(
                    ["John Smith", "Jane Doe", "Paul Dupont", "Liz Jones", "Marie Taylor"]);
                private function searchName(item:Object):Boolean
                    return item.toLowerCase().search(searchBox.text) != -1;
                private function textChangeHandler():void
                    names.filterFunction = searchName;
                    names.refresh();
                    searchBox.dataProvider = names;
                private function itemSelectedHandler(event:SearchBoxEvent):void
                    fullName.text = event.item as String;   
            ]]>
        </fx:Script>
        <s:layout>
            <s:HorizontalLayout verticalAlign="middle" horizontalAlign="center" />
        </s:layout>
        <s:Panel title="Components Samples"
                 width="600" height="100%"
                 color="0x000000"
                 borderAlpha="0.15">
            <s:layout>
                <s:HorizontalLayout horizontalAlign="center"
                                    paddingLeft="10" paddingRight="10"
                                    paddingTop="10" paddingBottom="10"/>
            </s:layout>
            <s:HGroup >
                <s:Label text="Type a few characters to search:" />
                <local:SearchBox id="searchBox" textChange="textChangeHandler()" itemSelected="itemSelectedHandler(event)"/>
            </s:HGroup>
            <mx:FormItem label="You selected:" >
                <s:TextInput id="fullName"/>
            </mx:FormItem>
        </s:Panel>
    </s:Application>

    Hello,
    Instead of extracting the first zero element from the vid array, you should take that out and connect it allone.
    Attachments:
    init.bmp ‏339 KB

  • Is it possible to make a 2D array (or whatever-dimension) array like..

    Is it possible to make a 2D array (or whatever-dimension) array like this...
            collumn 1                   collumn 2
    Emulated Address   Real Memory address*
               (int)                            (int *)
    +----------------------+----------------------------+
    |            0                |              0xA0               | <-- row 1
    |            1                |              0xA1               | <-- row 2
    |            2                |              0xA2               | <-- row 3
    +----------------------+----------------------------+
    * A = Address.
    is it possible to make an array like that?
    if it is, please tell me how to do it...
    thanks.
    ... I'm trying to make an emulator to emulate the simplest memory.

    Given your other posts, I'm assuming you mean in C, right?
    If so, the answer is yes, but specifically how will depend on a needed clarification of your question.  What you present doesn't really need to be a 2 dimensional array, just one: that looks like a simple list of memory addresses, right?
    At the simplest you can declare an array with two dimensions `iny myarray[2][3];` but to make the table you put up there you'd only need `int *myarray[3];`
    If you also wanted space allocated somewhere that each element of that list pointed to, you could allocate them separately:
    int *myarray[3];
    myarray[0] = (int *) malloc(sizeof(int));
    myarray[1] = (int *) malloc(sizeof(int));
    myarray[2] = (int *) malloc(sizeof(int));
    Obviously with many entries this should be in a loop.  Perhaps not as obviously, why would you not just malloc a larger block of memory to start with?
    What is the end goal?
    EDIT: actually, upon rereading your question, the mallocs are probably irrelevant.  `int *myarray[3]` will get you the array you are looking for.  Just realize that until you point those pointers to memory you 'own' you shouldn't assign to or read from them.
    Last edited by Trilby (2013-04-19 10:06:31)

  • Two dimension array?

    Show me the code for two dimension array in JSP!
    Thanks in advance!

    Hi,
    I am new in Java but maybe I can help you:
    Two-dimnsional arrays you can declare in following way:
    String[][] someArray;
    When you want to allocate space for new array you can do something like this:
    someArray = new String[5][5];
    All Arrays have a data variable called length, which you can inspect to find out how many elements there are in the array.
    For multi-dimensional arrays, each dimension has a length property.
    int[] [] a1 = {{ 0, 1, 2 },{ 3, 4, 5 }};
    for (int i=0; i < a1.length; i++) {
    for (int j=0; j < a1.length; j++) {
    prt(i + "," + j + "=" + a1[i][j]);
    Hope this is of help to you.
    Mirkos

  • How to initialize the array of hashmap???

    how to initialize the array of hashmap??

    What do you mean by "the array of hashmap"?

  • Selecting one dimension of a two dimension array?

    hi, i want to select only one dimension of an array and put it into an arraylist (or casting the array verbatim into the arraylist)
    for example, here is an two dimension array:
    Object[][] data =
         {  { new Date(), "A", new Integer(1), Boolean.TRUE },
         { new Date(), "B", new Integer(2), Boolean.FALSE },
         { new Date(), "C", new Integer(9), Boolean.TRUE },
         { new Date(), "D", new Integer(4), Boolean.FALSE}
         };and i want to cast it into an arraylist, what i have in mind (a bit troublesome is the following:)
    ArrayList dataArray = new ArrayList();
    dataArray.add(data[0]);
    dataArray.add(data[1]);
    dataArray.add(data[2]);
    dataArray.add(data[3]);
    System.out.println(dataArray);when come upon the last System.out.println, i got some seemly useless addresses:
    [[Ljava.lang.Object;@f73c1, [Ljava.lang.Object;@789144, [Ljava.lang.Object;@1893efe, [Ljava.lang.Object;@186c6b2]
    how do you accomplish casting a two dimension array into an arraylist, but the second dimension of the arraylist is kept as Array of Objects? thanks alot!

    First, the strings that are printed out are the value of the hashcode for the specific object. That is the default value that is printed out for any object reference in a class that inherits the toString() method from the Object class. This is true for arrays. Your ArrayList contains array references in it..
    So, you are printing the object hashcodes for the arrays in your ArrayList, instead of the contents of those arrays. It would be better if you created ArrayLists, or even designed an object that stores your data, and stored those inside your ArrayList. ArrayList has an overwritten toString() method that will print the contents instead of the object hashcode, so an ArrayList containing ArrayLists would print your data the way you want. If you define your own class, you will need to provide a toString() method that prints the contents the way you want.
    PS, look at http://java.sun.com/j2se/1.5.0/docs/api/java/util/AbstractCollection.html#toString() for more information on the toString() method used by ArrayList.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Matrix in  java using  two dimension array

    hi!
    Everybody here's a problem I have cpould any body out there give nice piece of sourcr code for "matrix in java using two dimension array"I have to give a presentation how it works.Yes I'd appreciate as many example as possible
    If anybody can??
    Please help
    regards
    ardent

    nice piece of sourcr
    code for "matrix in java using two dimension
    n arraySure,
    int[][] matrix = new int[5][5];
    That declares a two-dimensional 5 by 5 array with integer elements. All elements are initially 0.
    For further information check you favourite Java textbook.

  • How to initialize Button Array at "declaration"?

    How to initialize Button Array at "declaration"?
    Button[] b = new Button[2];
    b[0] = "label" ?
    b[1] = "label" ?
    Again,please at declaration not using setText within main program.

    main...
    Button[] btts = {new Button(...),new Button(...), ...)
    that shold be it
                                                                                                                                                                                   

  • 2 dimension array size error

    Hello,
    In attached file a exemple of my problem. I delete a 2 dimension array and display the size. I can notice in "size 2" (see the exemple") that the size is not at 0. Is It a normal behaviour?
    Thanks in advance, Daniel.
    Solved!
    Go to Solution.
    Attachments:
    ArraySize.vi ‏17 KB

    > So, there is no link between the display and the size array function
    I guess you are right - the display shows values - not memory allocation.
    One could make the case that it would be nice if the Delete from Array function was smart enough to realize that you just deleted the last of the array so why not get rid of any remaining rows/columns. On the other side of the coin, the Delete from Array function is not intended to be a Delete Array function and there may be performance issues on large arrays to add that functionality.
    To be honest, I was a bit puzzled by this until I saw the help documentation (i.e. rows or columns - not both). That's when I decided to check the array to see if it really was the size that was reported - and it was.
    You can also see this same functionality if you make an 2D array constant on the block diagram. Set values for the first column. Then right click and pick delete column. The array appears empty. Now enter a value in row zero, column zero. You will see that values for all of the rows you had previously set will be created. The memory for the rows was retained. 
     - very interesting find Daniel.
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.

  • How to print out the position of 2 dimension arrays?

    there are 2 dimension arrays, how can print out the position of value than 4?
    for example
    0 2 3 2 2 2
    0 1 1 2 5 3
    1 2 3 3 2 1
    print out:
    The pos is ( 5,2).

    Hello
    If I understand your question correctly, you are trying to print out the indexes where the value in your matrix is greater than 4
    If this is the case, then what you need to use is nested for loops e.g.
    for (int i = 0; i< array[0].length; i++)
    for (int j = 0; j< array[].length; j++)
    int value = array[i][j];
    if (value > 4)
    System.out.println("The pos is (" + i + "," + j + ")" );
    Regarding the syntax I have used to get the size of the array, I am not sure if this is correct, but you should have an idea of what I am doing.
    Sajid

  • Combined declaration and initialization of array

    Hello All,
    What is the difference between the below mentioned arrat initializations?
    int myArray[]=new int[] {1,2,3,4,5};
    int myArray[]={1,2,3,4,5};
    but both of them behaves in same way.
    Regards
    Sojan

    The first creates an anonymous array and copies its reference in the variable myArray. The second implicitly creates and initializes an array (there isn't really a perceptible difference). However, the second can only be used in declarations. Consider the following:
    int[] iArray = {1, 2, 3};
    iArray = new int[] {9, 8, 7}; // works
    iArray = {9, 8, 7}; // doesn't work !!!Hope this helps,
    Pierre

  • Initialize an array of union types

    Hi,
    I'm trying to the use the C99 designated initializer feature to initialize an array of union types, but I'm getting a compiler error as shown below. Am I using the correct syntax?
    #include <stdio.h>
    union U
         struct {int data;} a;
         struct {int type; float data;} b;
    int
    main()
         union U x = {.b.type = 2, .b.data = 1.0};
         union U y[] = {{.b.type = 2, .b.data = 1.0}};
         fprintf(stderr, "x b data: %f\n",    x.b.data);
         fprintf(stderr, "y b data: %f\n", y[0].b.data);
         return 0;
    }% cc u.c
    "u.c", line 13: structure/union designator used on non-struct/union type
    "u.c", line 13: structure/union designator used on non-struct/union type
    cc: acomp failed for u.c
    % cc -Version
    cc: Sun C 5.9 DEV 2006/06/08
    %

        union U x = { .b = { .type = 2, .data = 1.0 } };
        union U y[] = {{.b = { .type = 2, .data = 1.0}}};

  • 2-dimension array

    hi,JDC people.
    i want to use a 2-dimension array, the length of the first dimension is know, the length of the second dimension varies. how could i define and add elements to the array? shall i use ArrayList?
    can anyone give some hint or simple example? thanks.

    In Java, you don't (strictly speaking) have a two-dimensional array, you have an array of arrays.
    If you know the length of the first array (dimension), you can declare it thusly:Object[][] objectsArray = new Object[2][]; // You've declared and initialised one 'dimension';You can then declare each of the second arrays (dimensions) in turn:objectsArray[0] = new Object[5];
    objectsArray[1] = new Object[936];
    // etc.You then refer to each Object in the array(s), like this:Object something = objectsArray[0][3]; // Fourth object in first array
    Object somethingElse = objectsArray[1][935]; // 936th object in second arrayHope this is helpful...
    Chris.

Maybe you are looking for