Nested tables as separate lines in output

I'm working with Adobe forms using transaction SFP from the ABAP Workbench. I'm trying to construct a prototype of an SD invoice, with one internal table having the basic item data, and then a secondary table with further information, such as discounts, taxes, etc. The item number is part of both tables so that they can be related to each other. Using right-click and Create in the context I constructed a loop on the main table, and then under that a loop on the secondary table, with the equal item number as a condition. It all works, but in the output the secondary data comes out on the same line as the main item data, and when I try to drag it down to the next line in the layout, it changes its position in the data view also, so that it's outside the loop and prints only once, over the second main item line. Surely for an invoice or a purchase order it's normal to have one basic item line, and then one or more other lines with various other information for each item. It's very easy in both SAPscript and Smart Forms to have a loop within a loop displaying separate lines, but so far I haven't been able to get it to work with Adobe.

Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> CREATE OR REPLACE TYPE table_type AS TABLE OF VARCHAR2 (8);
  2  /
Type created.
SQL> CREATE TABLE r(
  2    a INTEGER,
  3    b table_type)
  4    NESTED TABLE b STORE as b_1;
Table created.
SQL> CREATE TABLE s(
  2    a INTEGER,
  3    b table_type)
  4    NESTED TABLE b STORE as b_2;
Table created.
SQL> INSERT INTO r VALUES (1, table_type ('a', 'b'));
1 row created.
SQL> INSERT INTO s VALUES (1, table_type ('b', 'c'));
1 row created.
SQL> COLUMN c FORMAT A10;
SQL> SELECT r.a, r.b MULTISET UNION DISTINCT s.b c
  2  FROM   r, s
  3  WHERE  r.a = s.a;
         A C
         1 TABLE_TYPE('a', 'b', 'c')
SQL>

Similar Messages

  • Nested Tables Repeat Header Row RTF Output Not Working v5.6.2(PDF does)

    All,
    Has anyone used nested tables in heading rows where they are set to repeat nested table header row across page breaks for RTF output ? This seems to work for PDF generation (line breaking enforcement doesn't) but I don't even get RTF Header ROWS indicated in my RTF output document. I have enabled them in my RTF template for the outer table row plus the inner nested table. Is this possible for RTF output or have I not indicated something in my RTF template or grouping clause ??
    Thanks,
    Tom

    All,
    Has anyone used nested tables in heading rows where they are set to repeat nested table header row across page breaks for RTF output ? This seems to work for PDF generation (line breaking enforcement doesn't) but I don't even get RTF Header ROWS indicated in my RTF output document. I have enabled them in my RTF template for the outer table row plus the inner nested table. Is this possible for RTF output or have I not indicated something in my RTF template or grouping clause ??
    Thanks,
    Tom

  • Apex, Tabular forms and Nested Tables := Headache

    Hi All,
    I'm constructing an Apex aplication for Performance Reviewing staff and I have need of nested tables within each line item for ongoing comments during the year, the headings of which are drawn from another table, based on a template for which ones are to be used at any given time.
    I'd like to be able to use a tabular form to draw out the history of comments at any given time and modify them however I'm at a complete loss as to how to get this working with a tabular form in Apex. If anyone could point me at some good documentation on the subject or even suggest a better method to get this done I'd be very grateful.
    Thanks!

    Hi,
    Take a look at this article:
    http://www.oracle-base.com/articles/misc/ObjectViewsAndNestedTables.php
    First, create a view as described on your nested and other table(s), with 'Instead Of' triggers handling the DML. Next create the tabular form based on the view. You'll find many posts in the forum regarding building a tablular form based on a view.
    Paul Brookes.

  • Explian plan with nested tables

    I am having an issue with getting an explain plan on a query that uses a nested table. In my tkprof output I am getting the error message.
    error during execute of EXPLAIN PLAN statement
    ORA-00932: inconsistent datatypes: expected - got CHAR
    Below is a copy of the tkprof output, the code for my oracle type, and the code for my pl/sql procedure.
    Thanks,
    CP
    INSERT
    INTO cp_temp_1
    (col_1)
    SELECT ct0.col_2
    FROM TABLE(CAST(:b1 AS tab_id)) vi
    INNER JOIN cp_temp_0 ct0 ON ct0.col_1 = vi.id
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.01 5 19 5 8
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.01 5 19 5 8
    Misses in library cache during parse: 0
    Optimizer goal: CHOOSE
    Parsing user id: 71 (CPARK) (recursive depth: 1)
    Rows Row Source Operation
    8 MERGE JOIN
    8 SORT JOIN
    8 TABLE ACCESS FULL CP_TEMP_0
    8 SORT JOIN
    2 COLLECTION ITERATOR PICKLER FETCH
    error during execute of EXPLAIN PLAN statement
    ORA-00932: inconsistent datatypes: expected - got CHAR
    parse error offset: 190
    DROP TYPE tab_id;
    DROP TYPE obj_id;
    CREATE TYPE obj_id AS OBJECT
    (id INTEGER);
    SHOW ERRORS
    CREATE TYPE tab_id AS TABLE OF obj_id;
    SHOW ERRORS
    CREATE OR REPLACE PROCEDURE cpark.prc_cp_test
    IS
    CURSOR cur_cp_test
    IS
    SELECT obj_id(col_1)
    FROM (SELECT DISTINCT
    col_1
    FROM cp_temp_0);
    v_ids tab_id := tab_id();
    BEGIN
    OPEN cur_cp_test;
    FETCH cur_cp_test BULK COLLECT INTO v_ids;
    CLOSE cur_cp_test;
    INSERT
    INTO cp_temp_1
    (col_1)
    SELECT ct0.col_2
    FROM TABLE(CAST(v_ids AS tab_id)) vi
    INNER JOIN cp_temp_0 ct0 ON ct0.col_1 = vi.id;
    END;
    SHOW ERRORS
    CREATE TABLE CP_TEMP_0 (
    COL_1 INTEGER,
    COL_2 INTEGER)
    TABLESPACE USERS
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    NOCACHE;
    CREATE TABLE CP_TEMP_1 (
    COL_1 INTEGER)
    TABLESPACE USERS
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    NOCACHE;
    D:\oracle\admin\play\udump>tkprof play_ora_3792.trc trc_01.txt EXPLAIN=cpark/password@play SORT=EXEELA,FCHELA

    and the complete example
    SQL> create or replace TYPE t_indirizzo AS OBJECT (
      2  via VARCHAR(45),
      3  numero NUMBER,
      4  cap INTEGER(5),
      5  citta VARCHAR(30),
      6  provincia VARCHAR(30),
      7  regione VARCHAR(30)
      8  );
      9  /
    Type created.
    SQL>
    SQL>
    SQL> create or replace TYPE t_telefono AS OBJECT (
      2  num_tel NUMBER(15)
      3  );
      4  /
    Type created.
    SQL>
    SQL> create or replace TYPE t_listaTelefono AS TABLE OF t_telefono
      2  /
    Type created.
    SQL>
    SQL> create or replace TYPE t_cliente AS OBJECT (
      2  cod_cliente NUMBER(8),
      3  indirizzo t_indirizzo,
      4  email VARCHAR(30),
      5  telefono t_listaTelefono
      6  ) NOT FINAL;
      7  /
    Type created.
    SQL>
    SQL> CREATE TABLE cliente OF t_cliente(
      2  cod_cliente NOT NULL,
      3  indirizzo NOT NULL,
      4  email NOT NULL,
      5  PRIMARY KEY (cod_cliente)
      6  ) nested table telefono store as numTelCli_tab
      7  return as value
      8  /
    Table created.
    SQL>

  • Trying to UNION two views with nested tables

    I am using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod, and my objective is to generate some XML. What I have been doing in the past, is to create a view, and then pass that view to the DBMS_XMLQuery routine. This gives me a CLOB that I pass along to the application. A typical object would be something like:
    create or replace type XML_UGroup_Member_Type as object (
         username          varchar2(128),
         group_key          varchar2(128));
    create or replace type XML_UGroup_Member_List
        as table of XML_UGroup_Member_Type;
    show errors
    Create or replace type XML_UGroup_Type as object (
         Group_Space     varchar2(32),
         group_key     varchar2(128),
         group_name     varchar2(255),
         members          XML_UGroup_Member_List);
    /This particular application will be doing stuff with group information. Pretty simply types - a group with a name and a few other keys, and a list of members. A sample view would be like:
    create or replace view xml_department_ugroup_view of xml_ugroup_type
      with object identifier ( group_key ) as
      Select 'Department',
          'Department:' || orgn_code,
          'Department_' || orgn_name
          cast ( multiset (
               select  Username, person_id,
                        'Department:' ||  effective_orgn
                from directory_master dm, logins l
               where effective_orgn = dd.orgn_code
                 and dm.person_id = l.owner)
                as XML_UGroup_Member_List )
             as members
       from directory_departments dd
      where dept_include = 'Y';
    can select from this view, and I can pass it to the DBMS_XMLQUERY package and get a nice XML document. What I want to is essentially put several of these views together, like
    Select * from XML_Department_Ugroup_View
    Union
    Select * from XML_Portfolio_Ugroup_View;But UNION does not work with nested tables:
    ERROR at line 1: ORA-00932: inconsistent datatypes: expected - got SIMON.XML_UGROUP_MEMBER_LIST
    What I was hoping to do, was to develop a set of sub views for each of the group "spaces", and then generate a view/object that includes all of the sub views, and be able to operate with that single object.
    Thoughts on how to make this work, or on alternate approaches? I have considered calling XMLQuery on each of the sub views and concatenating the XML documents and returning that to the application, but I was hoping to find a more "unified" approach.

    I modified my approach a bit - I changed the base views to return an XMLType object, like:
    create or replace view xml_portfolio_ugroup_xml
    as
    Select XMLElement("group",
             xml_ugroup_type(
          'Portfolio',
             'Portfolio:' || coas_code || ':' || orgn_Code,
          cast ( multiset (
               select  Username,
                from directory_master dm, logins l
               where ( effective_orgn, effective_coas ) in
               where effective_orgn = dd.orgn_code
                  and dm.person_id = l.owner
                as XML_UGroup_Member_List ))) as grp
       from directory_departments dd
      where dept_include = 'Y';and then I combined them with something like the following (I expect to adjust this as I learn more about the XML DB support)
    create or replace view xml_ugroup_xml as
      select xmlconcat(
         (select xmlagg(grp) from xml_department_ugroup_xml),
         (select xmlagg(grp) from xml_portfolio_ugroup_xml)
         ) as GROUPS
         from dualand as I define more group branches, I can add them into the XMLConCat stanzas. I am still open to suggestions as to ways of doing this better or cleaner, but this at least gets the project moving forward again.

  • Drop nested table

    CREATE TABLE test (
    id VARCHAR2(20),
    Cert_refs cert_ref_list)
    NESTED TABLE Cert_refs STORE AS Cert_refs_tab;
    1) After droping the table test, the object "Cert_refs_tab" has
    not been deleted. How can I drop it ?
    2) Is it possible to drop a nested table column ?
    Thank you.

    Hi
    When you store data of nested table in separate table you need
    to drop this table after droping base table.
    In the past it was not possible to drop column in Oracle table
    but no it is. I am not sure what is the first version for this.
    Regards

  • Nested table for PO Output (Item texts) - trying again.

    Hi experts
    I posted this question already, but the formatting disappeared, so trying again.
    I have created a PDF version of the Purchase Order output. Everything works well, except for the last step - a nested table where I want to display Item texts from the PO for every item.
    The steps I followed:
    1. In the Interface, I read the item texts, and placed them in an internal table, where the table has a field EBELP (item number) and a field for the text. So, for a PO with 5 items, where 2 items have texts, the table might look like this:
         00010    First line of text for item 10.
         00010    Second line of text for item 10.
         00040    Only line of text for item 40.
    2. In the context of the form, I put this table 'under' the existing 'ITEM' entry. In other words, for every item, the texts must be displayed. Obviously I then put in an entry under the WHERE CONDITIONS to say that EBELP = ITEM-EBELP, otherwise it would repeat every line of text for every item.
    The problem is that it does not behave quite as I expected. It currently prints:
    Item 10 information
             First line of text for item 10.
             Second line of text for item 10.
    Item 20 information
             Only line of text for item 40.
    Item 30 information
    Item 40 information
    Item 50 information
    Where it should print:
    Item 10 information
             First line of text for item 10.
             Second line of text for item 10.
    Item 20 information
    Item 30 information
    +Item 40 information+
             Only line of text for item 40.
    Item 50 information
    In other words, it simply 'breaks' on change of EBELP, and moves the text to the next line, as opposed to the correct line.
    I tried debugging, and it does appear to be doing things in the right order, but it is still doing the output incorrectly. I also searched the forums for similar problems, but I could not find a solution to the problem I am experiencing.
    I also put 'dummy' (empty) rows into the table - that fixes it, but then it messes with my layout and I get something like:
    Item 10 information
             First line of text for item 10.
             Second line of text for item 10.
    Item 20 information
    Item 30 information
    Item 40 information
             Only line of text for item 40.
    Item 50 information
    In the above, I don't want the gaps where the empty rows are.
    Please advise?
    Thanks and kind regards
    Casper

    Reposted without formatting...
    I have created a PDF version of the Purchase Order output. Everything works well, except for the last step - a nested table where I want to display Item texts from the PO for every item.
    The steps I followed:
    1. In the Interface, I read the item texts, and placed them in an internal table, where the table has a field EBELP (item number) and a field for the text. So, for a PO with 5 items, where 2 items have texts, the table might look like this:
         00010    First line of text for item 10.
         00010    Second line of text for item 10.
         00040    Only line of text for item 40.
    2. In the context of the form, I put this table 'under' the existing 'ITEM' entry. In other words, for every item, the texts must be displayed. Obviously I then put in an entry under the WHERE CONDITIONS to say that EBELP = ITEM-EBELP, otherwise it would repeat every line of text for every item.
    The problem is that it does not behave quite as I expected. It currently prints:
    Item 10 information
             First line of text for item 10.
             Second line of text for item 10.
    Item 20 information
             Only line of text for item 40.
    Item 30 information
    Item 40 information
    Item 50 information
    Where it should print:
    Item 10 information
             First line of text for item 10.
             Second line of text for item 10.
    Item 20 information
    Item 30 information
    Item 40 information
             Only line of text for item 40.
    Item 50 information
    In other words, it simply 'breaks' on change of EBELP, and moves the text to the next line, as opposed to the correct line.
    I tried debugging, and it does appear to be doing things in the right order, but it is still doing the output incorrectly. I also searched the forums for similar problems, but I could not find a solution to the problem I am experiencing.
    I also put 'dummy' (empty) rows into the table - that fixes it, but then it messes with my layout and I get something like:
    Item 10 information
             First line of text for item 10.
             Second line of text for item 10.
    Item 20 information
    Item 30 information
    Item 40 information
             Only line of text for item 40.
    Item 50 information
    In the above, I don't want the gaps where the empty rows are.
    Please advise?
    Thanks and kind regards
    Casper

  • How to use nested tables with the inner table in a separate row

    Hi,
    I am having a problem when changing our existing Adobe printform delivery note so that serial numbers are written for each item line.
    I've searched the forum and found many posts relating to nested tables, but none that had exactly my situation.
    Currently I print item lines like this (this uses the complete width of the form):
    Pos....Quantity...Material..........Description..................................................Date
    99.........99.........ABCDEFGH....alksdalksjdlkasjdlsajdlkjasldjaslkdjakslj........9999.99.99
    .................................................fskdjflsdfljsdflkjsdlkfjsdlkjfdfsf
    .................................................asdkadsfdkfhsdkfhskjdfhks
    but I want to add serial numbers after that for each item like this:
    Pos....Quantity...Material..........Description...................................................Date
    99.........99.........ABCDEFGH....alksdalksjdlkasjdlsajdlkjasldjaslkdjakslj.........9999.99.99
    .................................................fskdjflsdfljsdflkjsdlkfjsdlkjfdfsf
    .................................................asdkadsfdkfhsdkfhskjdfhks
    .................................................Serial numbers:
    .................................................9999999999..9999999999..9999999999
    .................................................9999999999..9999999999..9999999999
    I have added serial numbers to my the current table in the interface/context/data view so it look like this:
    TTYP - ITEM_FIELDS
    ...DATA structure
    ......POSNR
    ......QTY
    ......MATNR
    ......TTYP - ITEM_TEXTS
    .........DATA structure
    ............DESCRIPTION
    ......DATE
    ......TTYP - SERIAL_NOS
    .........DATA structure
    ............SERIAL_COL1
    ............SERIAL_COL2
    ............SERIAL_COL3
    In my Hierarchy I currently have this hierarchy and binding:
    Table - ITEM_FIELDS
    ...Body Row - DATA
    ......Cell - POSNR
    ......Cell - QTY
    ......Cell - MATNR
    ......Subform - ItemTexts
    .........Table - ITEM_TEXTS
    ............Body Row - DATA
    ...............Cell - DESCRIPTION
    ......Cell - DATE
    Now I am trying to add the SERIAL_NOS table into the ITEM_FIELDS/DATA body row right after the DATE cell - but I am not allowed to drag anything into the table structure.
    Does anybody have an ida how I can achieve this, please?
    Kind regards,
    Claus Christensen

    HI,
          Set the body page as flowed and set the tables also flowed.
    go to bodypage>object->subform-->select flowed option.
    I thihnk this will work..if u are getting all the records properly into the tables 1 and 2.
    Thanks,
    Mahdukar

  • SQ01 Output From Joining VBSEGK and VBSEGS tables-1 line of output per DOC

    I setup a query using SQ01 which uses tables VBSEGK and VBSEGS ( parked documents).   The VBSEGS table has multiple lines per document in that there are multiple G/L accounts, cost centers and amounts in order to distribute expense acorss multiple cost centers from one vendor's invoice.     When I execute the query only the first line item in the VBSEGS table appears and the remaining lines do not appear.    Any insight to get all line items for each document from the VCSEGS table to appear will be appreciated.

    Hi,
    By default four links will be established between VBSEGK and VBESGS.
    AUSBK
    BELNR
    GJAHR
    BZKEY (This link should be removed for getting all the records)
    However, you get the line items only if documents exist in both the tables.  Apart from that, if two line items in one table and three line items in another table, you will get only three line items in the report.  You need to select fields related to VBSEGK and VBSEGS tables.
    Please provide me more information on your exact requirement.  I can confirm you whether this  is possible by way of query.
    Best Regards,
    Madhu

  • Problem in creation of Nested Table

    Hi Everyone,
    I have applied thisexample for creating nested tables but at the end I got the message of invalid datatype
    current_address full_mailing_address_type,
    ERROR at line 4:
    ORA-00902: invalid datatype
    http://www.praetoriate.com/oracle_tips_nested_tables.htm
    Please help me out.....
    Message was edited by:
    Dharmendra

    What is the output for
    select * from user_types
    ?

  • Nested table collection in select query "in clause" taking long time

    create or replace type t_circuitids is table of varchar2(100);
    --Below anonymous block keeps on running and never ends
    DECLARE
       v_circuitid    t_circuitids;
       v_count number;
       l_circuitids   VARCHAR2 (4000)
          := 'value1,value2,value3,value4,value5';
    BEGIN
    --Below query converts comma concatinated output to list and stores in nested table collection v_circuitids
       WITH a AS
            (SELECT ',' || l_circuitids || ',' AS circuitid
               FROM DUAL)
       SELECT DISTINCT TRIM (SUBSTR (circuitid,
                                     INSTR (circuitid, ',', 1, LEVEL) + 1,
                                       INSTR (circuitid, ',', 1, LEVEL + 1)
                                     - INSTR (circuitid, ',', 1, LEVEL)
                                     - 1
                            ) cid
       BULK COLLECT INTO v_circuitid
                  FROM a
            CONNECT BY LEVEL <
                             LENGTH (circuitid)
                             - LENGTH (REPLACE (circuitid, ','));
       SELECT COUNT (1)
         INTO v_count
         FROM table
        WHERE name IN (SELECT COLUMN_VALUE
                                          FROM TABLE (v_circuitid));
    END;
    --I got the issue, query "SELECT COLUMN_VALUE FROM TABLE (v_circuitid)" which is used in above code is responsible for this.
    --Same code works fine in Development and Test environments, But in prod it keeps on running
    --I solved this issue by creating a temp table, loading all values in collection into the temp table and using that temp table in "in clause"    "
    --Can any one answer why its behaving like this when i use collection in where clause?
    --I am using Oracle 9i

    Below is the code i used
    DECLARE
       v_circuitid    t_circuitids;
       v_count number;
       l_circuitids   VARCHAR2 (4000)
          := 'value1,value2,value3,value4,value5';
    BEGIN
    --Below query converts comma concatinated output to list and stores in nested table collection v_circuitids
       WITH a AS
            (SELECT ',' || l_circuitids || ',' AS circuitid
               FROM DUAL)
       SELECT DISTINCT TRIM (SUBSTR (circuitid,
                                     INSTR (circuitid, ',', 1, LEVEL) + 1,
                                       INSTR (circuitid, ',', 1, LEVEL + 1)
                                     - INSTR (circuitid, ',', 1, LEVEL)
                                     - 1
                            ) cid
       BULK COLLECT INTO v_circuitid
                  FROM a
            CONNECT BY LEVEL <
                             LENGTH (circuitid)
                             - LENGTH (REPLACE (circuitid, ','));
       SELECT COUNT (1)
         INTO v_count
         FROM table
        WHERE name IN (SELECT COLUMN_VALUE
                                          FROM TABLE (ccard(v_circuitid)));
    END;
    And got below error
    ORA-06550: line 27, column 5:
    PL/SQL: ORA-00906: missing left parenthesis
    ORA-06550: line 24, column 4:
    PL/SQL: SQL Statement ignored

  • Issue with Mulidimensional Nested Table

    Hi All,
    I am studing Multidimensional Nested table and have the below code:
    DECLARE
      TYPE table_type1 IS TABLE OF INTEGER;
      TYPE table_type2 IS TABLE OF TABLE_TYPE1;
      table_tab1 table_type1 := table_type1();
      table_tab2 table_type2 := table_type2(table_tab1);
    BEGIN
      FOR i IN 1 .. 2
      LOOP
        table_tab2.extend;
        table_tab2(i) := table_type1();
        FOR j IN 1 .. 3
        LOOP
          IF i = 1
          THEN
            table_tab1.extend;
            table_tab1(j) := j;
          ELSE
            table_tab1.extend;
            table_tab1(j) := 4 - j;
          END IF;
            table_tab2.extend;
          table_tab2(i)(j) := table_tab1(j);
          DBMS_OUTPUT.PUT_LINE('table_tab2(' || i || ')(' || j || '): ' ||
                               table_tab2(i) (j));
        END LOOP;
      END LOOP;
    exception
      when others then
        dbms_output.put_line(sqlerrm);
    END;
    This code is working fine as of now.But,If i comment below code(table_tab2 is also extended latter):
    table_tab2.extend; 
        table_tab2(i) := table_type1();
    then it gives me error 'Subscription Beyond count'.
    I would like to know why i need to extend table_tab2 twice?
    Thanks!

    This code is working fine as of now
    No, it isn't. Make sure you have serveroutput on. If you do, you get this as script output (I am using SQL Developer):
    anonymous block completed
    ...meaning no exception was raised to client, because you trapped it, but the DBMS Output window gives:
    ORA-06533: Subscript beyond count
    ...with no indication of which line, because you suppressed it (why?). If you drop the worse than useless exception handler, you get:
    ORA-06533: Subscript beyond count
    ORA-06512: at line 22
    06533. 00000 -  "Subscript beyond count"
    *Cause:    An in-limit subscript was greater than the count of a varray
               or too large for a nested table.
    *Action:   Check the program logic and explicitly extend if necessary.
    A bit more helpful, yes? and with less code. Here is a revised block that writes the loop variable product to the nested array, with its output, initialising and extending correctly:
    DECLARE
      TYPE table_type1 IS   TABLE OF INTEGER;
      TYPE table_type2 IS   TABLE OF table_type1;
      table_tab1            table_type1;
      table_tab2            table_type2 := table_type2();
    BEGIN
      FOR i IN 1..2 LOOP
        table_tab1 := table_type1();
        FOR j IN 1..3 LOOP
          table_tab1.extend;
          table_tab1(j) := i * j;
        END LOOP;
        table_tab2.extend;
        table_tab2(i) := table_tab1;
      END LOOP;
      FOR i IN 1..table_tab2.COUNT LOOP
        FOR j IN 1..table_tab2(i).COUNT LOOP
          DBMS_OUTPUT.PUT_LINE('Row ' || i || ' element ' || j || ' = ' || table_tab2(i)(j));
        END LOOP;
      END LOOP;
    END;
    Row 1 element 1 = 1
    Row 1 element 2 = 2
    Row 1 element 3 = 3
    Row 2 element 1 = 2
    Row 2 element 2 = 4
    Row 2 element 3 = 6
    You could alternatively dispense with table_tab1 if you prefer, and write directly each element.

  • Nested Tables? Why do I need them?

    Hi! I am reading the PL/SQL reference about collections right now and I have reached the nested tables. And I can not understand the advantages of using them. There is an example there
    INSERT INTO department
    VALUES('English', 'Lynn Saunders', 'Breakstone Hall 205',
    CourseList('Expository Writing',
    'Film and Literature',
    'Modern Science Fiction',
    'Discursive Writing',
    'Modern English Grammar',
    'Introduction to Shakespeare',
    'Modern Drama',
    'The Short Story',
    'The American Novel'));
    So, what is the point of having nested table instead of two separate tables? I think it is a waste of memory, data duplication and problems related to it. Please tell me the real life example of useful use of nested tables. Thanks.

    A practical example of a nested table.
    I have written an application logging API in PL/SQL. Messages wind up being inserted via anonymous transactions into a relational table.
    This PL/SQL logging process also takes a snapshot of the PL/SQL call stack at that point in time and store the stack with the message as a column. The call stack itself is in fact a table. i.e. stack = (handle, object name and source code line number). Thus the STACK column in this table is a nested table.
    One could have used a separate table for the call stack (traditional parent-child relationship). However, there are absolutely nothing in common between the call stack of one message and that of another. One would never want to query all call stacks to find what was the code running at stack level 4, or what line number was used at stack level 2, etc.
    It is much easier to manage and query and maintain the call stack as a nested column (a "dedicated table") for a row as it only ever related to that row and nothing else.

  • NESTED TABLES,,Header data and Item data

    How to arrange them in the hierarchy view?
    How to put a condition on the item table so that only corresponding items  from the item table will be shown for each header.
    header table data 1211
                      1212
    item table data is 1211  10
                       1211  20
                       1212  10
                       1212 20
    so final output should be
    1211
    1211  10
    1211  20
    1212
    1212  10
    1212  20.
    So how to put this condition?
    Can you please help me
    Regards
    sasi

    Hi,
    If you designing the form using SFP Transaction, then you have to set the where clause on the item table in the context.
    In the SFP context drag the header table from interface.drag the item table from interface on the DATA in the header table. it will placed at the end of the header table. Now select the item table select where clause in the properties ( at the bottom of the screen ).there you create a line for condition using create button. drag the field from header table field ( say header-matnr ) on the right side and then drag the same field from the item table ( say item-matnr) in the left side.This will filter the item records relevent for header record.
    In the layout, design the table as I explained in the forum message .( search forum with text "Nested Tables and Multiple Pages" ) 
    pavan meda

  • Varray, Nested Table and Object types in OWB r2

    Requirement:
    Flat file with repeating groups of nested content need to move into Object Relational ORACLE table (using varray or nested tables - no preference). The data will be loaded, then mapped/transformed into a richer O-R output to directly produce XML outputs.
    Problem:
    Generated PL/SQL "seems" to do the correct thing, but deployment errors show failures on mapping of collections (varrays, NTs or OTs) and in sqlplus recompiling the PKB still gives the errors. Is this a PL/SQL generator error, or is there a more meaningful example of using CONSTRUCT OBJECT operator than the embedded odcumentation - it is a simple type (single instance) and not a variable repeating group of nested data.
    Anyone had any success with these, or know of any collateral to assist in the process. Thanks.

    The process we are following is very simple. We are talking 10 columns from a source flat file table and wish to map this into a Varray/Nested table, with one column of Varchar2(10).
    When you create your map in OWB, select the construct object, you have to choose an object type - it does not allow you to select a VARAAY or NESTED table.
    I have then created an object defined in the same structure as the VARRAY/NESTED table - I have then made the VARRAY/NESTED table of this TYPE.
    Example:
    CREATE OR REPLACE TYPE "O_REL_PUB_INDEX" AS OBJECT (
    X_REL_PUB_INDEX_1 VARCHAR2(10))
    CREATE OR REPLACE TYPE "V_REL_PUB_INDEX" AS VARRAY(15) OF O_REL_PUB_INDEX
    In OWB you can then select O_REL_PUB_INDEX when creating the 'Contruct Object'.
    The problem I have is that when I map to my target column of type V_REL_PUB_INDEX and DEPLOY my map I get the following errors taken from OWB control centre
    Name
    Action
    Status
    Log
    TEST
    Create
    Warning
    ORA-06550: line 2931, column 9:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 3174, column 11:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    TEST
    Create
    Warning
    ORA-06550: line 401, column 7:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 643, column 13:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    TEST
    Create
    Warning
    ORA-06550: line 7221, column 9:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 7464, column 11:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    Any ideas? anyone succesfully mapped to either a VARRAY or an NESTED TABLE target column?

Maybe you are looking for