How to refer to element in multi-dimensional array?

What do I need to change in the following dbms_output statement to display "Ken" and avoid the error?
Thanks,
-Ken
create or replace type kja_person_name_rec as object
( pena_id number(10)
, pers_id number(10)
, pnty_cd varchar2(10)
, first_nm varchar2(100)
, family_nm varchar2(100)
Type created
create or replace type kja_person_name_tbl as table of kja_person_name_rec not null;
Type created
create or replace type kja_person_rec as object
( pers_id number(10)
, birth_dt date
, person_names kja_person_name_tbl
Type created
create or replace type kja_person_tbl as table of kja_person_rec not null;
Type created
declare
  l_person_name  kja_person_name_rec;
  l_person_names kja_person_name_tbl;
  l_person       kja_person_rec;
  l_persons      kja_person_tbl;
begin
  l_person_name  := kja_person_name_rec( 1, 1, 'LEGAL', 'Ken', 'Anderson');
  l_person_names := kja_person_name_tbl( l_person_name);
  l_person       := kja_person_rec( 1, to_date( '1955-SEP-22', 'YYYY-MON-DD'), l_person_names);
  l_persons      := kja_person_tbl( l_person);
  dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names.first_nm);
end;
declare
  l_person_name  kja_person_name_rec;
  l_person_names kja_person_name_tbl;
  l_person       kja_person_rec;
  l_persons      kja_person_tbl;
begin
  l_person_name  := kja_person_name_rec( 1, 1, 'LEGAL', 'Ken', 'Anderson');
  l_person_names := kja_person_name_tbl( l_person_name);
  l_person       := kja_person_rec( 1, to_date( '1955-SEP-22', 'YYYY-MON-DD'), l_person_names);
  l_persons      := kja_person_tbl( l_person);
  dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names.first_nm);
end;
ORA-06550: line 13, column 80:
PLS-00302: component 'FIRST_NM' must be declared
ORA-06550: line 13, column 3:
PL/SQL: Statement ignored
SQL>

Hi,
Ken Anderson wrote:
What do I need to change in the following dbms_output statement to display "Ken" and avoid the error?
Thanks,
-Ken
create or replace type kja_person_name_rec as object
( pena_id number(10)
, pers_id number(10)
, pnty_cd varchar2(10)
, first_nm varchar2(100)
, family_nm varchar2(100)
Type created
create or replace type kja_person_name_tbl as table of kja_person_name_rec not null;
Type created
create or replace type kja_person_rec as object
( pers_id number(10)
, birth_dt date
, person_names kja_person_name_tbl
Type created
create or replace type kja_person_tbl as table of kja_person_rec not null;
Type created
declare
l_person_name  kja_person_name_rec;
l_person_names kja_person_name_tbl;
l_person       kja_person_rec;
l_persons      kja_person_tbl;
begin
l_person_name  := kja_person_name_rec( 1, 1, 'LEGAL', 'Ken', 'Anderson');
l_person_names := kja_person_name_tbl( l_person_name);
l_person       := kja_person_rec( 1, to_date( '1955-SEP-22', 'YYYY-MON-DD'), l_person_names);
l_persons      := kja_person_tbl( l_person);
dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names.first_nm);
end;
declare
l_person_name  kja_person_name_rec;
l_person_names kja_person_name_tbl;
l_person       kja_person_rec;
l_persons      kja_person_tbl;
begin
l_person_name  := kja_person_name_rec( 1, 1, 'LEGAL', 'Ken', 'Anderson');
l_person_names := kja_person_name_tbl( l_person_name);
l_person       := kja_person_rec( 1, to_date( '1955-SEP-22', 'YYYY-MON-DD'), l_person_names);
l_persons      := kja_person_tbl( l_person);
dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names.first_nm);
end;
ORA-06550: line 13, column 80:
PLS-00302: component 'FIRST_NM' must be declared
ORA-06550: line 13, column 3:
PL/SQL: Statement ignored
SQL>
L_persons(1).person_names is a kja_person_name_tbl. Kja_person_name_tbls don't have first_nms; only kja_person_name_recs do.
Next to the end, instead of
   dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names.first_nm);try
dbms_output.put_line( 'l_persons(1).first_nm = '|| l_persons(1).person_names(1).first_nm);
--                                                                   added  ^^^

Similar Messages

  • How can I (neatly) control mouse click events in a multi-dimensional array?

    Hello everyone!
         I have a question regarding the use of mouse clicks events in a multi-dimensional array (or a "2D" array as we refer to them in Java and C++).
    Background
         I have an array of objects each with a corresponding mouse click event. Each object is stored at a location ranging from [0][0] to [5][8] (hence a 9 x 6 grid) and has the specific column and row number associated with it as well (i.e. tile [2][4] has a row number of 2 and a column number of 4, even though it is on the third row, fifth column). Upon each mouse click, the tile that is selected is stored in a temporary array. The array is cleared if a tile is clicked that does not share a column or row value equal to, minus or plus 1 with the currently targeted tile (i.e. clicking tile [1][1] will clear the array if there aren't any tiles stored that have the row/column number
    [0][0], [0][1], [0][2],
    [1][0], [1][1], [1][2],
    [2][0], [2][1], [2][2]
    or any contiguous column/row with another tile stored in the array, meaning that the newly clicked tile only needs to be sharing a border with one of the tiles in the temp array but not necessarily with the last tile stored).
    Question
         What is a clean, tidy way of programming this in AS3? Here are a couple portions of my code (although the mouse click event isn't finished/working correctly):
      public function tileClick(e:MouseEvent):void
       var tile:Object = e.currentTarget;
       tileSelect.push(uint(tile.currentFrameLabel));
       selectArr.push(tile);
       if (tile.select.visible == false)
        tile.select.visible = true;
       else
        tile.select.visible = false;
       for (var i:uint = 0; i < selectArr.length; i++)
        if ((tile.rowN == selectArr[i].rowN - 1) ||
         (tile.rowN == selectArr[i].rowN) ||
         (tile.rowN == selectArr[i].rowN + 1))
         if ((tile.colN == selectArr[i].colN - 1) ||
         (tile.colN == selectArr[i].colN) ||
         (tile.colN == selectArr[i].colN + 1))
          trace("jackpot!" + i);
        else
         for (var ii:uint = 0; ii < 1; ii++)
          for (var iii:uint = 0; iii < selectArr.length; iii++)
           selectArr[iii].select.visible = false;
          selectArr = [];
          trace("Err!");

    Andrei1,
         So are you saying that if I, rather than assigning a uint to the column and row number for each tile, just assigned a string to each one in the form "#_#" then I could actually just assign the "adjacent" array directly to it instead of using a generic object to hold those values? In this case, my click event would simply check the indexes, one at a time, of all tiles currently stored in my "selectArr" array against the column/row string in the currently selected tile. Am I correct so far? If I am then let's say that "selectArr" is currently holding five tile coordinates (the user has clicked on five adjacent tiles thus far) and a sixth one is being evaluated now:
    Current "selectArr" values:
           1_0
           1_1, 2_1, 3_1
                  2_2
    New tile clicked:
           1_0
           1_1, 2_1, 3_1
                  2_2
                  2_3
    Coordinate search:
           1_-1
    0_0, 1_0, 2_0, 3_0
    0_1, 1_1, 2_1, 3_1, 4_1
           1_2, 2_2, 3_2
                  2_3
         Essentially what is happening here is that the new tile is checking all four coordinates/indexes belonging to each of the five tiles stored in the "selectArr" array as it tries to find a match for one of its own (which it does for the tile at coordinate 2_2). Thus the new tile at coordinate 2_3 would be marked as valid and added to the "selectArr" array as we wait for the next tile to be clicked and validated. Is this correct?

  • How to achieve Multi Dimensional array in Oracle

    Hi,
    Pls give me a solution to achieve the Multi dimensional Array concept in Oracle.
    I've used Nested table concept in which I did not find any Equivalent for the array structure in COBOL given below
    01 customer_record.
    &nbsp&nbsp&nbsp03 telephone_number occurs 3 times.
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp05 country_code pic 999.
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp05 area_code pic 999.
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp05 local_number occurs 2 times.
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp08 prefix pic 999.
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp08 subscriber_number pic 999.
    Thanks in Advance
    Regds,
    Arkumar

    What about VARRAYs and user defined objects?

  • Binding arraylist, list, or multi-dimensional array to table in web dynpro

    Greetings,
    I like to ask if anyone knows how to bind data from an arraylist, list, or multi-dimensional array list to a table in web dynpro, your help is much appreciated.
    Thanks in advance.
    Cory

    Is there a way to create or cast a multi-dimensional
    array from a Collection or Vector ?
    ArrayList list = new ArrayList();
    list.add( new Object[4] );
    Object[] array2 = list.toArray(); // is only
    single dimension !
    Of course it is a single dimension array.
    Check the definition of the toArray() function, and the specification of arrays in general.
    toArray() returns a one dimensional array.
    In your case it will return an array of arrays. So array2[0] will be an array of 4 objects.
    That just happens to be a 2 dimensional array though you may (I haven't checked it) need some parentheses to call the elements.
    Try Object o = array2[0][1]; and if that doesn't work Object o = (array2[0])[1];

  • Cloning multi-dimensional arrays

    I am working on this program of mine and really need some help since I am completely stuck, the thing is that I am trying to clone a multi-dimensional array, I have tried with a simple array and that worked fine, but not with the multi-dimensional. Like this:
    int[] initialSquareValues3 = {1,2,3};
    int[] squareValues3 = initialSquareValues3.clone();
    System.out.println(initialSquareValues3[0]);
    System.out.println(squareValues3[0]);
    squareValues3[0] = 3;
    System.out.println(initialSquareValues3[0]);
    System.out.println(squareValues3[0]);
    Will give the output "1 1 1 3", just what i want. While this:
    int[][] initialSquareValues2 = {{1,2,3}, {4,5,6}, {7,8,9}};
    int[][] squareValues2 = initialSquareValues2.clone();
    System.out.println(initialSquareValues2[0][0]);
    System.out.println(squareValues2[0][0]);
    squareValues2[0][0] = 3;
    System.out.println(initialSquareValues2[0][0]);
    System.out.println(squareValues2[0][0]);
    Will give the output "1 1 3 3" where "squareValues2" only seems to be a reference to the same data as the original "initialSquareValues2"
    So the question is simply: How do i clone a multi-dimensional array?
    I'm running Java SE 5.0 (1.5.0) and the code is run inside the contructor in a class extending JPanel.

    No need to explicitly do any copying of elements except as part of deepening the clone.
        public int[][] cloneIntArrays(int[][] array)
            // Create shallow clone
            int[][] clonedArray = array.clone();
            // Deepen the shallow clone
            for (int index = 0; index < clonedArray.length; index++)
                clonedArray[index] = clonedArray[index].clone();
            return clonedArray;
        }

  • Multi-dimensional arrays in Cocoa

    Oh, dear. After spending the best part of 12 hours entering 2,000+ elements of a multi-dimensional array into a 'plist', I then start looking on the net for reasons why my C-style code won't compile and read that I can only use single-dimensional arrays?
    WHAT? Arrrrrgghhh! ^#&}@!
    Looking at both array types in a 'plist' they look like:
    // one-dimensional...
    <array>
    <array>
    <string>Aberayron</string>
    </array>
    <array>
    <string>Abergavenny</string>
    </array>
    <array>
    <string>Aberystwyth</string>
    </array>
    </array>
    // ...and multi-dimensional
    <array>
    <array>
    <string>Aberayron</string>
    <string>XXVII</string> // pre-1852 style
    <string>11b</string> // modern style
    </array>
    <array>
    <string>Abergavenny</string>
    <string>XXVI</string>
    <string>11a</string>
    </array>
    <array>
    <string>Aberystwyth</string>
    <string> XXVII </string>
    <string>11b</string>
    </array>
    </array>
    but apparently I can't access the other column elements using say:
    [aTextField setStringValue: [anArray objectAtIndex: [counter][2]]];
    What makes it even more frustrating is that when my app is launched, the runlog quite happily displays the contents of the array as:
    'districts array' returned (
    (Aberayron, XXVII, 11b),
    (Abergavenny, XXVI, 11a),
    (Aberystwyth, XXVII, 11b),
    ....... etc. etc .........
    Can anyone (hopefully) tell me I misread all those 'net posts and suggest a simple way I can access this data using maybe, an offset of bytes in memory please?
    Ernie

    Ernie Thompson wrote:
    Oh sure, with the benefit of hindsight my beginners example had serious Cocoa syntax errors, but what was so wrong with the underlying idea on which my question was based?
    There wasn't anything "wrong", it was just in the wrong context. I'll explain...
    I am mindful of the efforts good people like yourself put into helping us 'newbies' here, and rather than waste your collective times posting every trivial question that we ourselves could solve in a few short minutes with an internet search, I spend a considerable amount of time doing just exactly that before I post. However, I constantly come across statements like:
    ...Since Obj-C, like C++, is a superset of C (and basically IS C...)... It's actually one of the
    major annoyances (to me anyway) of working in pure Obj-C code on this project: there is no direct
    support for multi-dimensional arrays... etc. etc..
    I completely understand your confusion. The Internet is stuffed full of information of all kinds. Not all of it is correct information, however. I'm not even sure the majority is correct.
    and that is just a tiny cross-section of comments. As I found myself doing on at least one previous occasion, I once again apologise for having been misled, Quite clearly, with arrays being supported in Obj-C (as you have demonstrated) -- while at the same time not being supported , and Obj-C being C -- while also not being C, learning Cocoa is clearly going to take a little more time than I initially anticipated.
    OK, I'll explain. Objective-C is a superset of C. Anything you can do in C, you can do in Objective-C. You can certainly create and use multidimensional arrays in Objective-C exactly how you wanted to originally. But that kind of array is a C array, such as:
    int arr[512];
    or
    double * matrix = malloc(sizeof(double) * 32 * 32);
    An "NSArray" is an entirely different thing. It is not a C array, it is an Objective-C object. Any time you have bracket characters, you are dealing with Objective-C objects. They have no built-in syntax other than:
    [receiver message: arg param2: arg2 param3: arg3 ... paramN: argN];
    If you really want to get confused, you could look at C++ or even Objective-C++. There, you can have arrays that really are arrays but are objects too. On second thought, you probably don't want to do that
    PS: Don't worry about wasting my time. I only post here so I can clear my mind from whatever I'm working on and give my subconscious an opportunity to find a fix for all the screw-ups I've done in my code.
    Message was edited by: etresoft

  • Assigning values to 2D Multi-Dimensional arrays ??

    How do I assign a value to a Multi-dimensional 2D Array,
    that has the righter array size omitted as it changes�.
    Code�
    SomeObj foobar = new SomeObj (first, second);
    SomeObj [ ] [ ] d2D = new SomeObj [10] [ ];
    d2D [0][0] = foobar;     //Causes a null pointer exception�
    NB: seems if I initiate �d2D = new SomeObj [10] [10];� with the righter array size initiated then the error doesn�t occur, but because of the nature of the data the size of each secondary array varies�
    Thx. Kharsim

    apparently not...
    from what i read up on Multi-Dimensional arrays, you only have to give a value to the leftest bracket...
    e.g.
    int [ 5 ] [     ] [     ] <~ Acceptable in Java
    int [ 5 ] [  6 ] [     ] <~ Acceptable in Java
    int [ 5 ] [  6 ] [ 24 ] <~ Acceptable in Java
    int [ 5 ] [     ] [ 24 ] <~ Not acceptable in Java
    so using arrays it should be possible to assign a value in either of the acceptable cases, but couldnt find a source that had such an example...

  • Populating ADF Table from Multi-Dimensional Array

    Hello!
    I'm trying to populate an ADF table from a multi-dimensional array.
    Let's say that my array is
    String [] [] myArr = new String [3][5].
    On my page backing bean, I have a private attribute called tmpArr like this...
    String [] [] tmpArr;
    ...which I will initialize later after I know the proper dimensions. The dimensions will come from a multimap that contains a key and and another array (for the key's value) containing values for the key. So once I know the dimensions I initialize my array with...
    tmpArr = new String [x][y] where x and y are the dimensions (counters).
    Now I have my multidimension array. On an jsp page I have an ADF table, and I'm setting the value for the table to the array (the table's value property is bound to the backing bean's tmpArr attribure).
    Like so:
    <af:panelForm id="availableOptions"
    binding="#{myBackingBean.availableOptionsValues}">
    <af:table emptyText="No items were found" rows="10"
    value="#{myBackingBean.tmpArr}" var='myArr'>
    Now I need to know how to do the following:
    1) Set the table's columns based on the number of attributes on the array.
    2) Set the table's rows based on the array's length.
    3) Set each table cell value to values on the array's 2nd dimension. I'm assuming that ADF takes care iterating through the array, and that I should do something like...
    <af:outputText value="#{myArr[][0]}"/>
    <af:outputText value="#{myArr[][1]}"/>
    etc...
    However, this isn't working...
    javax.faces.el.ReferenceSyntaxException: myArr[][0]
    ...bla bla bla...
    Was expecting one of:
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <STRING_LITERAL> ...
    "true" ...
    "false" ...
    "null" ...
    "not" ...
    "empty" ...
    <IDENTIFIER> ...
    Is there a blog or resource (article, book, etc) that shows how this is done? Anyone has done this and would like to share how?
    Thank you.

    This is in fact possible. I'm not sure about the "best practice" around doing this but there is a couple of ways to do this.
    You can either create a managed bean then right click on it and use the wizard to create a data control or you can do it as per below
    The a table will convert an array into a collection.
    Once you have created an array and generated the accessors in a bean you can then reference the mutli-dimensional array from a table as per below.
    <af:table value="#{pageFlowScope.PageBean.sessionArr}" var="row" rowBandingInterval="0" id="t1" varStatus="status">
    <af:column sortable="false" headerText="col1" id="c1">
    <af:outputText value="#{pageFlowScope.PageBean.sessionArr[status.index][0]}" id="ot1"/>
    </af:column>
    </af:table>
    String [][] sessionArr = new String[5][2];
    public void setSessionArr(String[][] sessionArr) {
    this.sessionArr = sessionArr;
    public String[][] getSessionArr() {
    sessionArr[0][0]="rice";
    sessionArr[1][0]="water";
    return sessionArr;
    EDIT: For either of the above methods the managed bean must have a scope of pageFlow or longer.
    Cheers,
    Aaron
    Edited by: Aaron Rapp on Oct 6, 2011 3:28 PM

  • Best practice in JSTL with multi-dimensional arrays

    Hi,
    I'm working in a project and I'm trying to convert some code into JSTL way, I have a first.jsp that calls addField(String, String) from fieldControl.jsp:
    (first.jsp)
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ include file="fieldControl.jsp" %>
    <html>
    <head><title>JSP Page</title></head>
    <body>
    <%! String[][] list1;
    %>
    <%
    list1 = new String[2][2];
    list1[0][0]="first_1";
    list1[0][1]="first_2";
    list1[1][0]="second_1";
    list1[1][1]="second_2";
    for (int i=0;i<list1.length;i++){
    String html;
    html = addField (list1[0], list1[i][1]);
    out.println(html);
    %>
    </body>
    </html>
    (fieldControl.jsp)
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page language="java" %>
    <%! public void addField(String name,String label)
    return ...
    Now for JSTL I've this example from "JSTL pratical guide for JSP programmers" Sue Spielman:
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <html>
    <head>
    <title>
    Display Results
    </title>
    </head>
    <body>
    <%-- Create a HashMap so we can add some values to it --%>
    <jsp:useBean id="hash" class="java.util.HashMap" />
    <%-- Add some values, so that we can loop over them --%>
    <%
         hash.put("apples","pie");
         hash.put("oranges","juice");
         hash.put("plums","pudding");
         hash.put("peaches","jam");
    %>
    <br>
    <c:forEach var="item" items="${hash}">
    I like to use <c:out value="${item.key}" /> to make <c:out value="${hash[item.key]}" />
    <br>
    <br>
    </c:forEach>
    </body>
    </html>
    and my problem is :
    1st - how to use the multi-dimensional array in this way (<jsp:useBean id="hash" class="java.util.HashMap" />) ? because if I use it like this
    <% String[][] list1;
    list1 = new String[2][2];
    list1[0][0]="first_1";
    list1[0][1]="first_1";
    list1[1][0]="second_1";
    list1[1][1]="second_2";%>
    <c:out value="${list1}" />
    <c:out value="${list1.lenght}" />
    I get nothing,
    also tryed <c:set var="test" value="<%=list1.length%>" /> and got "According to TLD or attribute directive in tag file, attribute value does not accept any expressions"
    2nd hot to make the call to the method addField?
    Thanks for any help, I really want to make this project using JSTL, PV

    When you are using JSTL, it is best to not put data inside the JSP. Put it inside JavaBeans. Then make calles to the methods in those JavaBeans.
    So you should get used to JavaBeans and their requirenments.
    Access JavaBeans only through 2 types of methods: getters and setters.
    Getters are used to "get" values (properties) from the bean, and always have the form
    public Type getPropertyName(void)
    That is, they are public, return some value, start with the exact string "get" end with the name of the property (first letter of the property name capitalized) and have a void (empty) argument list.
    For example, this is a good signature to get HTML from a bean:
    public String getHtml()
    Setters are used to assign values to a bean. They always have the form
    public void setPropertyName(Type value)
    That is, they are public, do not return anything, start with the string "set", end with the name of the property (first letter capitalized), and take a SINGLE parameter.
    public void setHtml(String value)
    Also, JavaBeans must have a no argument constructor and need to be Serializable.
    The way I would approach this would be to create a JavaBean that holds the two dim array for you, and has a getter that returns a list of all the formatted html.
    package mypack;
    import java.util.List;
    import java.util.ArrayList;
    public class DataFormatterBean implement java.io.Serializable {
      private String[][] list;
      public DataFormatterBean() {
        list = new String[2][2];
        list[0][0]="first_1";
        list[0][1]="first_2";
        list[1][0]="second_1";
        list[1][1]="second_2";
      public List getHtml() {
        List outputHtml = new ArrayList(list.length);
        for (int i = 0; i < list.length; i++) {
          String html = addField(list[0], list[i][1]);
    outputHtml.add(html);
    return outputHtml;
    private addField(String a, String b) { .. do work .. }
    Then, the JSP would look like this:
    <jsp:useBean id="dataFormatter" class="mypack.DataFormatterBean"/>
    <c:forEach var="htmlString" items="${dataFormatter.html}">
      <c:out value="${htmlString}"/>
    </c:forEach>Once you start thinking in terms of having JavaBeans do your work for you JSTL is so much easier... and it gets even easier when you start to delve into custom tags.

  • Use of multi-dimensional arrays in forms - forms debugger crash

    Hello All readers,
    have an issue with use of multi-dimensional arrays in forms when debugging and/or calling another form post array-population.
    USING VERSIONS: oracle forms 9.0.4, Jinitiator 1.3.1.17, oracle db 10.1
    the following code snippet works from a when-button-pressed trigger when called without the debugger. when called with the debugger it crashes when any element of the multi-dimensional associative array is accessed/populated/read. In addition, if i populate the multi-dimensional array then call a form (a msgbox form to display the arrays content as a string) it crashes too.
    declare
    type datasource_rec is record (field varchar2(32), val varchar2(3999));
    type datasource_arr is table of datasource_rec index by binary_integer;
    type datasource_arr_arr is table of datasource_arr index by binary_integer;
         l_arr datasource_arr_arr;
         procedure poparr(i_arr out datasource_arr_arr) is
              idx binary_integer := 1;
              iidx binary_integer := 1;
         begin
              while (idx <= 10) loop
                   iidx := 1;
                   while (iidx <= 10) loop     
                        i_arr(idx)(iidx).field := 'field'||to_char(iidx)||':'||to_char(idx); --# debugger crashes here with JVM aborting... message (which crashes forms builder too)
    i_arr(idx)(iidx).val := 'test value';
                   iidx := iidx+1;     
                   end loop;
              idx := idx+1;
              end loop;
         end;
         procedure printarr is
              idx binary_integer := l_arr.first;
              iidx binary_integer;
              l_msg varchar2(4000);
              l_response pls_integer;
         begin
              while (idx is NOT null) loop
                   iidx := l_arr(idx).first;
                   while (iidx is NOT null) loop
                        l_msg := l_msg||chr(10)||l_arr(iidx)(idx).field||' = '||l_arr(iidx)(idx).val;
                   iidx := l_arr(idx).next(iidx);
                   end loop;
              idx := l_arr.next(idx);
              end loop;
              alerts.info('see console for full printout: '||chr(10)||l_msg);
    --l_response := msgbox.show(l_msg); --calls another modal form to display a long message, which crashes the runtime with a java console message*
         r$debug.print(l_msg);
         end;
    begin
         poparr(l_arr);
         printarr;
    end;
    The java console does not print anything useful when both forms builder and the runtime crash/hangs as a result of the debugger being attached (except displaying a "JVM aborting" message) but when the runtime alone crashes as a result of calling another form after popping the MD array it prints:
    oracle.forms.net.ConnectionException: Forms session <28> aborted: unable to communicate with runtime process.
         at oracle.forms.net.ConnectionException.createConnectionException(Unknown Source)
         at oracle.forms.net.HTTPNStream.getResponse(Unknown Source)
         at oracle.forms.net.HTTPNStream.doFlush(Unknown Source)
         at oracle.forms.net.HTTPNStream.flush(Unknown Source)
         at java.io.DataOutputStream.flush(Unknown Source)
         at oracle.forms.net.StreamMessageWriter.run(Unknown Source)
    has anyone else encountered this problem and found a solution/workaround? is their some sort of memory limitation for forms-side handling of (multi-dimensional) arrays?+
    many thanks
    ps: i get similar problems when a) populating the array from a server/db-side packaged procedure (crashes with java console message as above even when not debugging) b) using server/db-side packaged types for the array.

    Hello All readers,
    have an issue with use of multi-dimensional arrays in forms when debugging and/or calling another form post array-population.
    USING VERSIONS: oracle forms 9.0.4, Jinitiator 1.3.1.17, oracle db 10.1
    the following code snippet works from a when-button-pressed trigger when called without the debugger. when called with the debugger it crashes when any element of the multi-dimensional associative array is accessed/populated/read. In addition, if i populate the multi-dimensional array then call a form (a msgbox form to display the arrays content as a string) it crashes too.
    declare
    type datasource_rec is record (field varchar2(32), val varchar2(3999));
    type datasource_arr is table of datasource_rec index by binary_integer;
    type datasource_arr_arr is table of datasource_arr index by binary_integer;
         l_arr datasource_arr_arr;
         procedure poparr(i_arr out datasource_arr_arr) is
              idx binary_integer := 1;
              iidx binary_integer := 1;
         begin
              while (idx <= 10) loop
                   iidx := 1;
                   while (iidx <= 10) loop     
                        i_arr(idx)(iidx).field := 'field'||to_char(iidx)||':'||to_char(idx); --# debugger crashes here with JVM aborting... message (which crashes forms builder too)
    i_arr(idx)(iidx).val := 'test value';
                   iidx := iidx+1;     
                   end loop;
              idx := idx+1;
              end loop;
         end;
         procedure printarr is
              idx binary_integer := l_arr.first;
              iidx binary_integer;
              l_msg varchar2(4000);
              l_response pls_integer;
         begin
              while (idx is NOT null) loop
                   iidx := l_arr(idx).first;
                   while (iidx is NOT null) loop
                        l_msg := l_msg||chr(10)||l_arr(iidx)(idx).field||' = '||l_arr(iidx)(idx).val;
                   iidx := l_arr(idx).next(iidx);
                   end loop;
              idx := l_arr.next(idx);
              end loop;
              alerts.info('see console for full printout: '||chr(10)||l_msg);
    --l_response := msgbox.show(l_msg); --calls another modal form to display a long message, which crashes the runtime with a java console message*
         r$debug.print(l_msg);
         end;
    begin
         poparr(l_arr);
         printarr;
    end;
    The java console does not print anything useful when both forms builder and the runtime crash/hangs as a result of the debugger being attached (except displaying a "JVM aborting" message) but when the runtime alone crashes as a result of calling another form after popping the MD array it prints:
    oracle.forms.net.ConnectionException: Forms session <28> aborted: unable to communicate with runtime process.
         at oracle.forms.net.ConnectionException.createConnectionException(Unknown Source)
         at oracle.forms.net.HTTPNStream.getResponse(Unknown Source)
         at oracle.forms.net.HTTPNStream.doFlush(Unknown Source)
         at oracle.forms.net.HTTPNStream.flush(Unknown Source)
         at java.io.DataOutputStream.flush(Unknown Source)
         at oracle.forms.net.StreamMessageWriter.run(Unknown Source)
    has anyone else encountered this problem and found a solution/workaround? is their some sort of memory limitation for forms-side handling of (multi-dimensional) arrays?+
    many thanks
    ps: i get similar problems when a) populating the array from a server/db-side packaged procedure (crashes with java console message as above even when not debugging) b) using server/db-side packaged types for the array.

  • Setting up a multi dimensional array of objects

    Hey ya'll. How would i setup a multi dimensional array with this structure?
    TypeSave(Title, material(name, quantity))
    TypeSave[1](Lego Shop, material[1](Lego Blocks, 100))
                   material[2](Roof, 1))
    TypeSave[2](Lego Car, material[1](Door, 2))
              material[2](Gravy, 3, ounces))
    TypeSave will be saved as a serialised object to a file so i can load everything within it and keep the structures integrity.
    I'll have an add button that will add the name and quantity to the next empty position of "material" array. This will then be listed in a list box and allow me to save all the materials with a title to the TypeSave list in the next empty position.
    I'm getting mightily confused how to set up the classes and the array structure :(
    Any help would be greatly appreciated!

    private TypeSave t = new TypeSave();
    private void btnSaveItemActionPerformed(java.awt.event.ActionEvent evt) {                                             
            t.addItem(txtItemTitle.getText(), new Material(txtMaterialName.getText(),txtQuantity.getText()));
            t.saveToFile();
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new MainForm().setVisible(true);
        class Material implements Serializable {
         String name = null;
         String quantity = null;
         //To restrict default constructor
         private Material() {
         public Material(String name, String quantity) {
              this.name = name;
              this.quantity = quantity;
         public String getName() {
              return this.name;
         public String getQuantity() {
              return this.quantity;
         public String toString() {
              return "Name : " + this.name + "Quantity : " + this.quantity;
    class TypeSave implements Serializable {
         private Hashtable items = null;
         public TypeSave() {
              items = new Hashtable();
         public void addItem(String title,Material material) {
              ArrayList materials = (ArrayList) items.get(title);
              if(materials == null) {
                   materials = new ArrayList();
                   items.put(title,materials);
              materials.add(material);
         public Hashtable getItems() {
              return this.items;
         public ArrayList getItem(String title) {
              return (ArrayList)this.items.get(title);
            void saveToFile() {
        ObjectOutputStream oos = null;
            try
            oos = new ObjectOutputStream(new FileOutputStream("item.ser"));
            catch (IOException i)
              System.out.println( "Error opening file");
          try
            oos.writeObject(items);
            catch (IOException o)
                System.out.println("Error writing file");
          try
              if(oos != null)
              oos.close();
            catch (IOException x)
                System.out.println("Error closing file");
    }My save class was working, but i tried to merge it to test this code structure and now it's failing with excepion:
    "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException"
    any ideas?

  • Multi-dimensional arrays with non-specified dimension

    Hi all,
    I'm trying to write a method to create a multi-dimensional array of
    Integer, based on another one, taken as parameter. I would like the
    method to work for an array of a non-specified dimension, that is,
    it could take as parameter a Integer[], or a Integer[][], or a
    Integer[][][] and so on.
    The idea is to have as a result an array with the original elements
    doubled.
    Here is my recursive function:
        public static Object[] f(Object[] a) {
             // the array to be returned is created with the
             // same size as the original
            Object[] r = new Object[a.length];
            for (int i=0; i<a.length; i++) {
                Object elem = a;
    Object newElem = null;
    if (elem instanceof Object[]) {
    // Recursive case
    newElem = f((Object[]) elem);
    } else if (elem instanceof Integer) {
    // Base case
    newElem = new Integer(((Integer)elem).intValue() * 2);
    r[i] = newElem;
    return r;
    This method returns an array with the same structure (that is, same
    dimensions) of the array taken in the constructor. In the recursive
    case, it just calls the function to the inner arrays. In the base
    case, where I have an Integer, it creates a new Integer, whose
    value is the old multiplied by 2.
    Then I initialize an array:
        public static void main(String args[]) throws Exception {
            Integer[][] a = new Integer[][] {
                new Integer[] {
                    new Integer(0), new Integer(2)
                new Integer[] {
                    new Integer(1), new Integer(4), new Integer(3)
      // And try to call the function like this:
            Integer [][] b = (Integer [][]) f(a);
        }   And I get a java.lang.ClassCastException: [Ljava.lang.Object;
    I don't understand the reason of this exception, because the
    object returned is a Integer[][]. Isn't it?
    And since I don't have a compiler error in the cast, that means
    that Object[] and Integer[][] are not inconvertible. Right?
    Could anyone explain me why this is wrong and/or give me some
    ideas to do what I'm trying to do?
    Thanks a lot,
    Angela

    I retract my previous statement about using
    reflection. Use "Object[] r =(Object[])a.clone()"
    to create a new array of the same type.You don't need temporary array variable here.
    You could simply use argument a instead of r.
    (But this my gotcha is derived from your clever rep.)Well, this isn't a temporary variable, its the return variable, which is different. If you don't want the original matrix changed, you have to clone the argument.

  • Multi-dimensional Array Question

    Hi all,
    I am trying to build a Multi-dimensional Object Array from several One Dimensional Object Arrays. I am looping through a .properties file to determine how many individual Object Arrays will be added to the Multi-dimensional Array. The part that I am having trouble with is in adding each Array to the Multi-dimensional Array in the loop.
    For example:
      public Object[] getRowData(String row_str)
        StringTokenizer st = new StringTokenizer(row_str,"|");
        Object[] row_data = new Object[st.countTokens()];
        for(int i = st.countTokens();i > 0;--i)
          Arrays.fill(row_data,st.nextToken());
        return row_data;
      public Object[][] getTableData()
        int rows = new Integer(resources.getString("Rows")).intValue();
        Object[][] data = null;
        for(int j = 0;j < rows;j++)
          String row_str = resources.getString("row_"+j);
          Object[] row_data = getRowData(row_str);
    // Here is the prolbem.  I need to add each individual row_data Array to the Multi-dimensional Array(data) .
    //      data = row_data;  This does not work.
        return data;
      }Thanks in Advance.

    Set the 2darray size ...then do some casting ...don't forget the index [j]:
        Object[][] data = new Object[rows][0];
        for(int j = 0;j < rows;j++)    {
          data[j] = (Object[]) row_data;
        }

  • Pda 8.0 multi dimensional array support?

    I've just spent most of this day chasing down a problem with a vi I was attempting to port from a PC environment to a PDA (PocketPC).  I think I have found the problem but I would like some confirmation if this is a recognized problem (not supported) by NI or if this is supposed to be supported but does not work on my IPAQ hx2790 (running WM5.0).  The problem I have is that the PDA doesn't seem to support multi-dimensional arrays ... NI, or anyone else who might know the answer ... Is this supposed to be support or not?  Thanks
    Greycat

    That's a great one !
    I ran in the same bug a few hours ago (LV PDA 8.0 - iPAQ 4700 - WM 2003) . I could not believe it !!!
    It is simply not possible to index a 2D array to extract a single row or column. Yet it is possible to get an array element.
    I suppose there are other issues that will be exposed soon.
    I have no more time to waste on LV PDA. But I suggest a few search directions : I found that on LV embedded, array operators could not be used with disabled index inputs. In the attached example, I tried to find a workaround and I used a for loop to index each element of a column and build a 1D array. It works sometimes : Don't touch element (0,1) otherwise the vi hangs.
    That could be fun if this was not the dead-end of a 2 months work, fighting with LV PDA inefficiencies !
    May be I'll try LV PDA again when a new release will be available !
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    LV PDA 2D Array bug.vi ‏15 KB

  • Read file into multi-dimensional array - ideal world...

    Hello all, would be very grateful if you could help me...
    I have a file which has a format...
    string1a,string1b
    string2a,string2bi need to read this file, which will have a variable length, into a two dimensional array.
    the code below is just demonstrating my approach...
              List lines = new ArrayList();
              BufferedReader in = new BufferedReader(new FileReader(filename));
              String str;
              while ((str = in.readLine()) != null) {
                   lines.add(str.split(","));
              in.close();but when i later try and invoke the toArray() method of lines it complains about unsafe or unchecked operations.
    does any have any pointers about the best way to read a file into a multi-dimensional array? is it best practice to use the interface List?
    thanks in advance
    poncenby

    This is just a List of Lists - no worries there.
    Sounds like your toArray code is incorrect. Post that.
    %

Maybe you are looking for

  • Can you have multiple users for one account?

    Can you have multiple users for one account? if so how do you set it up. We are using it for our department and it would be great to see who created what form instead of it being all one name.

  • BAPI to create Inbound Delivery without reference

    Hi Folks, I'm working for a client who requires a process to create Inbound Deliveries <i><b>without reference</b></i> to a PO. Does anyone know of an existing BAPI that will meet this criteria? The fallback position is to look at using a BAPI like B

  • Apple iWorks - Pages/Keynote/Numbers - can I open these in MS Office?

    Hi all can someone please be so kind and let me know if there is a possibility to save Pages/Keynote/Numbers documents in a format thatI can open in MS Office and vice versa? Thank-you Magz

  • FAQ on Webdynpro for ABAP

    Can i get the FAQ on Webdynpro for ABAP ?

  • Adobe Reader for PlayBook is useless

    The Adobe reder for the PlayBook is almost completely useless. There's no "jump to page" feature - on a 6,000 page service manual, it is impossible to get where you need to go. There's no "Bookmarks" feature - again, on large documents that are organ