On the Table nested

Hi all

Why the following SQLs are unable to work? He told me that:

ERROR on line 1:
ORA-02320: failure in the creation of the table of storage for the nested table column
ACCESS_G
ORA-22913: must specify the name of the table for the nested table column or attribute

SQL:

CREATE or REPLACE TYPE el_type () AS OBJECT
ip_address VARCHAR2 (16));
/

CREATE or REPLACE TYPE el_tab_type AS TABLE OF THE el_type;
/

CREATE or REPLACE TYPE re_type () AS OBJECT
re_name VARCHAR2 (16).
el_g el_tab_type);
/

CREATE or REPLACE TYPE re_tab_type AS TABLE OF THE re_type;
/

CREATE TABLE actual_info)
profile_name VARCHAR2 (16).
access_g re_tab_type)
TABLESPACE DBdata
NESTED TABLE access_g STORE AS access_tab;
/

You have a table nested within a nested table, so you must specify the storage
for both tables nested.
Tom tells how do:
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:2969385152046

URS

Tags: Database

Similar Questions

  • help join you a table nested with ordinary table

    IM creating a nested table object prtcnpt_info codelist. In a block anonymous im saying t_code as type nested table codelist.
    Now when I try to join the table nested to ordinary table oracle DB and I get the error: PL/SQL: ORA-00904: "COLUMN_VALUE": invalid identifier.
    Please help me on this and provide link tutorial about this concepts... Here is the code I wrote

    -Start code.
    create or replace type prtcnpt_info as an object (identification number
    , name varchar2 (200)
    (, code varchar2 (30));


    create type codelist is the prtcnpt_info table;


    declare
    t_code codelist.
    Start

    Select prtcnpt_info (b.pid, b.name, pt.code) in bulk collect into t_code
    party pt
    mc_code b
    where pt.cd in ("AAA", "BBB")
    and pt.ptype_id = b.pt_type_id;


    INSERT INTO table (ID
    RUN_ID
    DATA
    P_ID
    )
    SELECT id
    run_id
    data
    prtct.id-> 1
    IN table_2 t2
    , (by selecting column_value in table (t_code)) prtct
    WHERE prtct.id = t2. P_ID; -> 2

    end;

    -End code;
    also of the anonymous block
    1 = > is this right until you get the id value (b.pid) of the tablet_code nested as prtct alias?
    2 = > is this right until you reach the nested with ordinary table table? I want to join the id column in the tables.

    Published by: 914912 on April 30, 2012 02:11

    Write the insert like this and try

    insert into table
    (
           id
         , run_id
         , data
         , p_id
    )
     select id,
         run_id,
         data,
         prtct.id
       from table_2 t2
         table(t_code) prtct
      where prtct.id = t2.p_id;
    
  • Table nested @ schema - level how to extract the first clue?

    Hello

    My version of oracle database: 11g

    I present to you the code here and here are the steps by which I created a table and theres a regular column to the number, but the 2nd column is a nested table.

    (1) create or replace type s_def_NT_DepEmployees is table of the varchar2 (100);

    2)

    create the table employees_NT_test

    (number of department_id

    c_of_s_def_NT_DepEmployees s_def_NT_DepEmployees)

    nested as NTs_c_of_s_def_NT_DepEmployees table c_of_s_def_NT_DepEmployees store

    (3) now, I inserted 2 records:

    insert into employees_NT_test values (1, s_def_NT_DepEmployees ('Rahul', 'Myra'));

    insert into employees_NT_test values (2, s_def_NT_DepEmployees ('Rashi', 'Gaurav'));

    (4) now get me this sql allows employees of department_id: 1

    Select column_value

    table (select c_of_s_def_NT_DepEmployees in the employees_NT_test where department_id = 1);

    Output:

    Rahul

    Myra

    Now my question: I want to just choose the first clue: IE: rahul (and not myra) and it should be compatible such that if I select the two departments I should get my output like:

    Department_id | employees

    1                    | Rahul

    2                    | Rashi

    PS: I am looking for a sql query, I hope I presented my question clearly, if there are doubts please let me know.

    Thanks in advance

    Rahul

    Now my question: I want to just choose the first clue: IE: rahul(and not myra) and should be consistent

    You can only do in a deterministic manner, given the current design.

    Unlike PL/SQL, SQL has no way to access the items in the collection of their indices.

    We can think about using ROWNUM (or ROW_NUMBER) in a subquery, but the SCOREBOARD operator and later join operations do not guarantee that the order will remain the same in the different calls.

    You must redefine the collection 's_def_NT_DepEmployees' as an array of objects, and this object would include an index attribute explicitly on which you can filter.

    The alternative is to create a function that takes the collection and the index for the arguments and returns the element at index - but even in this case I'm not sure that oracle could rebuild deterministically collection either.

    Why use a table nested at all?

  • SQL with the Table using nested

    Hello

    Please help how to do that thing

    I have a nested table of object type

    create or replace type a1 as an object

    (

    a number,

    b varchar2 (30),

    VARCHAR2 (30) region

    );

    create table a1 type a1_array s;

    declare

    v_a1 a1;

    v_a1_array a1_array:=a1_array();

    Start

    v_a1 = a1 (1, '1', 'AUS');

    v_a1_array. EXTEND;

    v_a1_array (1): = v_a1;

    v_a1 = a1 (2, '2', 'AUS');

    v_a1_array. EXTEND;

    v_a1_array (2): = v_a1;

    v_a1 = a1 (3, '3', 'NAM');

    v_a1_array. EXTEND;

    v_a1_array (3): = v_a1;

    end;

    Now, I v_a1_array have 3 row 2 with region AUS and the other with NAM region.

    SQL help can I get lines only "AUS" and look in the TABLE OF TYPE v_a1_array (using Where clause and functions (Table))

    Any help will be much appreciated. Please help. I have Oracle 11g

    Thank you

    I hope that you are looking for this.

    pretend like your excel temp (with clause)

    v_a2 - is a type of a1_array

    SQL > select * from v version $;

    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE Production 11.2.0.2.0
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    SQL > DROP TYPE a1_array;

    Type fell.

    SQL > DROP TYPE a1;

    Type fell.

    SQL > CREATE or REPLACE TYPE a1 AS OBJECT
    2 (a NUMBER, b VARCHAR2 (30), region VARCHAR2 (30));
    3.

    Type of creation.

    SQL > CREATE TYPE a1_array IS TABLE of a1;
    2.

    Type of creation.

    SQL > DECLARE
    v_a1 2 a1_array;
    3 v_a2 a1_array;
    4 BEGIN
    5 WITH temp
    6 AS (SELECT 1 a, 1 b, "AUS" AS region FROM DUAL
    7 UNION ALL
    8. SELECT 2 AS a, 2 b, "AUS" AS region FROM DUAL
    9 UNION ALL
    10. SELECT 3 a, b '3', 'NAM' AS region OF DOUBLE)
    11. SELECT a1 (x.a, x.b, x.region)
    In BULK 12 COLLECT IN v_a1
    Temp 13 x;
    14
    15 SELECT a1 (x.a, x.b, x.region)
    In BULK 16 COLLECT IN v_a2
    TABLE (v_a1) 17 x
    18 WHERE x.region = 'NAM ';
    19
    20
    21 FOR I IN 1... v_a2. COUNTY
    22 LOOP
    (23) DBMS_OUTPUT.put_line
    24 v_a2 (i) .a | '-' || v_a2 (i) .b | '-' || v_a2 (i) .region);
    25 END OF LOOP;
    26 END;
    27.
    3-3-NAM

    PL/SQL procedure successfully completed.

    SQL > spool off;

  • Adding record helps the dynamically nested table

    Hello guys im trying to add records to a nested table plsql dynamically. Here is my code that only adds a record. I can not figuered on why it's not more then add one record to the nested table. I think I would say at the table to update the index and insert the new index but I'm not sure on the index can someone throw me a BONE.
    I also tried the records, but I seem to be facing the same problem.
    create or replace
    PROCEDURE QUICKTEST AS 
    BEGIN
    /*declare and array to loop through. to write error log.*/
    declare
    TYPE local_table IS TABLE OF VARCHAR2(30);
    acct_code local_table;
    
    
    TYPE rec_type IS RECORD (       -- local RECORD type
        f1 INTEGER,
        f2 VARCHAR2(4)
      );
      r2     rec_type;                -- local type
    
    num number(17):=0;
    
    begin
    FOR Lcntr IN 1..20
    LOOP
        
        
         acct_code := local_table ('I');
         r2.f2 := num+1;
        
    num:=num+1;
    
    END LOOP;
    
    END QUICKTEST;

    I think you are looking for something in the lines of...

    CREATE OR REPLACE PROCEDURE quicktest
    AS
       TYPE local_table IS TABLE OF VARCHAR2(30);
    
       acct_code   local_table  := local_table();
    
       TYPE rec_type IS RECORD(   -- local RECORD type
          f1   INTEGER
         ,f2   VARCHAR2(4)
       );
    
       TYPE rec_type_arr IS TABLE OF rec_type
          INDEX BY BINARY_INTEGER;
    
       r2          rec_type_arr;   -- local type
       num         NUMBER(17)   := 0;
    BEGIN
       FOR lcntr IN 1 .. 20
       LOOP
          acct_code.EXTEND;
          acct_code(lcntr) := 'I' || lcntr;
          r2(lcntr).f1 := num + 1;
          r2(lcntr).f2 := 'J' || TO_CHAR(num + 1);
          num := num + 1;
       END LOOP;
    
       DBMS_OUTPUT.put_line(acct_code.COUNT);
       DBMS_OUTPUT.put_line(r2.COUNT);
    
       FOR i IN acct_code.FIRST .. acct_code.LAST
       LOOP
          DBMS_OUTPUT.put_line(acct_code(i));
       END LOOP;
    
       FOR i IN r2.FIRST .. r2.LAST
       LOOP
          DBMS_OUTPUT.put_line(r2(i).f1 || ' :: ' || r2(i).f2);
       END LOOP;
    END quicktest;
    /
    
  • Build/update dynamically the table 3D

    Hi all

    I'm having a problem with the dynamic generation of a 3D of the following set of data table:

    x: {1,2,3,4,5}

    y: {1,2,3,4,5}

    Z_1: {1,2,3,4,5}

    Z_2: {1,2,3,4,5}

    Z_3: {1,2,3,4,5}

    Z_4: {1,2,3,4,5}

    Z_5: {1,2,3,4,5}

    where there is (5) Z amplitudes associated with each measurement location.  What I am able to statically (from the above values x and y tables 1 d and 2D table Z) is to create a 3D Board made up of x and is indexed intensity to the graphic format of the 2D tables.  Each page of the table corresponds to each of the 5 Z amplitudes measured at each location.  In the attached VI, the Array Build function works perfectly for the static case where the entire data is available.  I followed the example of a another discussion forum will be subject to the provisions of nest two loops construction 2D array in the inner loop and incrementing the pages on the outer loop. The static situation is resolved.

    However, my goal is to graphically present data he is taken, point by point, to the user.  The other attached VI simulates this scenario, incrementation of x and y positions based on the measure button.  Z matrix indicator shows that the 2D Array (each individual page) is in the proper format.  The construction of the 3D picture is dynamically where I'm having problems.  I tried to build table and replace a subset of table, but none of these functions to produce the desired result.

    In the case of building table, 3D table is correctly based on the first measure: for x = y = 1, 2D array page0 is set Z_1 in position (1,1), page1 has the Z_2 value in the position (1,1), page2 Z_3, etc..  However, on the second measure, as expected, the berries are concatenated page5 have Z_1 values in the (1,1) and (2,2) positions.  This result is properly formatted, however, should the counted array 3D page is limited to 5 (page0, 1, 2, 3, 4).  So ideally, page5 should in this case replace page0.  So build array results in the correct format but concatenation is not desirable.

    The subset of spare board was made with the index of the page (outside of the loop) number to specify the subset of the 3D Board needs to be replaced.  The result was an empty 3D array.

    Thank you any help to solve this problem.

    kmsk wrote:

    Any suggestions on how to handle filling out table 3D of unknown size?

    If the size of the final table has a reasonable upper limit, you can initialize an array of slightly oversized, then keep using the subset of the table replace. It will be much faster and more effective memory than gradually more and more large networks.

    When the purchase is made, you can cut to the final size.

    Aircraft add to a table 3D using 'insert into array' or 'Build array' (favorite?), cause memory frequent shifts and might slow down your code by orders of magnitude in casing of excessive fragmentation of memory.

  • Why are my columns in the table narrower when living as view creation!

    Hi guys

    It's seriously making me crazy.
    If you scroll to the bottom of this page, you will see buttons description option and buy are crushed until the right part.

    They do not look like this in Design view if and I do not see how or what to change.
    http://preciousparcels.co.UK/baby.html

    Thanks in advance

    NAT x

    It is an easy fix if you nest just lines in the problem area in their own table.

    Insert below the last line of the suspended hearts order form (line 388)

             


    Put an end to this table nested 684 line just above the end current table

     

  • Record table Nested sorting

    Hello

    Can you help me to sort (based on join date) below table nested using the TABLE function?

    declare
    type is rendered
    (emp_id char (20),
    date of join_d);
    type emp_tbl_type is table of SheikYerbouti;

    non_sorted emp_tbl_type;
    asc_sorted emp_tbl_type;
    Start
    -create sample data

    non_sorted (1) .emp_id: = '1';
    non_sorted (1) .join_d: = sysdate + 5;
    non_sorted (2) .emp_id: = '2';
    non_sorted (2) .join_d: = sysdate + 1;
    non_sorted (3) .emp_id: = '3';
    non_sorted (3) .join_d: = sysdate + 7;
    non_sorted (4) .emp_id: = '4';
    non_sorted (4) .join_d: = sysdate + 7;

    for me in non_sorted.first... loop of non_sorted. Last

    dbms_output.put_line ('Emp ID :'|| non_sorted (i) .emp_id |) ' Date :'|| non_sorted (i) .join_d);
    end loop;

    Select emp_id, join_d
    LOOSE COLLECTION asc_sorted
    table (cast (non_sorted AS emp_tbl_type))
    order of join_d;
    -can you sort these data and move it to asc_sorted

    because me in 1... loop asc_sorted. Count

    dbms_output.put_line ('Emp ID :'|| asc_sorted (i) .emp_id |) ' Date :'|| asc_sorted (i) .join_d);
    end loop;


    end;

    Thank you!

    Thanks I fixed the issue after reading the oracle documentation.

    declare

    non_sorted emp_tbl_type: = emp_tbl_type();
    asc_sorted emp_tbl_type: = emp_tbl_type();

    / * cursor asc_cur is
    Select emp_id, join_d
    table (CAST (non_sorted AS emp_tbl_type))
    order of join_d; */

    Start
    -create sample data
    non_sorted.extend;
    non_sorted (1): = emp_rec('1',sysdate+5);
    non_sorted.extend;
    non_sorted (2): = emp_rec('2',sysdate+1);
    non_sorted.extend;
    non_sorted (3): = emp_rec('3',sysdate+7);
    non_sorted.extend;
    non_sorted (4): = emp_rec('4',sysdate+3);

    for me in non_sorted.first... loop of non_sorted. Last

    dbms_output.put_line ('Emp ID :'|| non_sorted (i) .emp_id |) ' Date :'|| non_sorted (i) .join_d);
    end loop;

    dbms_output.put_line ('* UNSORTED data ');

    Select emp_rec (emp_id, join_d)
    bulk collect into asc_sorted
    table (CAST (non_sorted AS emp_tbl_type))
    order of join_d;

    dbms_output.put_line ('* UNSORTED data ');
    because me in 1... loop asc_sorted. Count

    dbms_output.put_line ('Emp ID :'|| asc_sorted (i) .emp_id |) ' Date :'|| asc_sorted (i) .join_d);
    end loop;

    end;

    THX

  • the text of the table

    How to read the entire text of table in the file of the application

    What you mean

    A. by "read" and what do you mean by

    B "text table?

    And finally what do you mean by

    C application file.?

    At => write content not shaped in a file?

    B => an InDesign table?

    C => an InDesign document?

    If you have a selected table, you will get no content in the form of this way:

    var myTableContents = app.selection[0].contents;
    

    For all the tables in an InDesign document (No nested tables, no tables at the bottom of the page) you can get:

    var allTablesContents = app.documents[0].stories.everyItem().tables.everyItem().contents;
    

    variable allTableContents will be an array of arrays.

    Uwe

  • I am trying to create a function that would be on the table type returns.

    Gurus,

    I am trying to create a function that returns a table nested with 3
    columns in a table as a guy.

    my query is like

    Select col1, col2, col3 from table_1;

    I am a bit newbie in Oracle and have never used collections.
    Can you please guide?

    >
    I am a bit newbie in Oracle and have never used collections.
    >
    Then you should start with the documentation
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/TOC.htm

    Chapter 5 is all about collections using PL/SQL and examples
    >
    I am trying to create a function that returns a table nested with 3
    columns in a table as a guy.
    >
    This isn't enough of a description to know what you're trying to do, or how you plan to use the service. The query you provided is completely irrelevant to the question you are asking.

    You ask about functions in pipeline? Here is an example of this

    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
      )
      /
    
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
      /
    
    -- pipelined function 
    
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
      /
    
    select * from table(get_emp(20))
    
  • Nested table and tables nested inside (CREATE TABLE)

    Hi all

    I have a problem of creation of a table with some types defined by the user at several levels (and therefore the nested tables).

    All first of all objects:
    type top_object is object (
        text_top varchar2(100),
        table_a a_object_tbl,
        table_b b_object_tbl
    );
    
    type a_object_tbl is table of a_object;
    type a_object is object (
      text_a varchar2(100)
    );
    
    type b_object_tbl is table of b_object;
    type b_object is object (
      text_b varchar2(100),
      table_c c_object_tbl,
      table_d d_object_tbl
    );
    
    type c_object_tbl is table of c_object;
    type c_object is object (
      text_c varchar2(100)
    );
    
    type d_object_tbl is table of d_object;
    type d_object is object (
      text_d varchar2(100)
    );
    Shortly: the SUPERIOR object contains tables A and B. B includes tables C and D.


    Well, now I want to create a table that contains the TOP level object.
    My attempt:
    create table multilevel_table (
      some_value varchar2(100),
      data top_object
    )
    NESTED TABLE top_object.table_a STORE AS data1,
    NESTED TABLE top_object.table_b STORE AS data2
    (NESTED TABLE table_c STORE AS data3,
    NESTED TABLE table_c STORE AS data4);
    Of course, this does not (otherwise I would not have asked you ;)). If I jump the 'second level', so just deleting table_b top_object and, therefore, the "inner nested table' it works.
    But on this scenario more complex I don't know the right way or the syntax.

    I would be grateful if I get any help or suggestion on your part!

    + 1 for recommendation of Hoek of simply not using TABLEs IMBRIQUEES for persistent structures.

    But:

    create table multilevel_table (
      some_value varchar2(100),
      data top_object
    )
    NESTED TABLE data.table_a STORE AS data1,
    NESTED TABLE data.table_b STORE AS data2
    (NESTED TABLE table_c STORE AS data3,
     NESTED TABLE table_d STORE AS data4) ;
    
  • Conversion tables and the entries in the table

    I'm working on a conversion table for our former products of FM unstructured to DITA. I understand the basic concepts, but I'm having a problem with the table cells.

    I have P:CellBody in my conversion table, in the first row, mapped at the entrance with a cellbody qualifier.

    I also TC mapped at the entrance.

    The same applies to P:CellHeading, and Th.

    Therefore, my text is wrapped in two input elements. The context tab to show the item says:

    entry

    entry

    line

    TBODY

    tgroup

    Table

    body

    NoName

    NoName

    I'm sure it should be the same as above with the input only one element (and of course with the fixed NoNames which I think I know how to do; I just have not had here yet).

    How to avoid get my cells wrapped in two input elements?

    Thanks in advance,

    Marsha

    Marsha,

    I don't understand what you're trying to do, or what is exactly in your conversion table. Be aware, however, that FrameMaker will always create elements for the basic elements that occur in your tables. The table of conversion that you give little control of how these items will be marked, but not question whether elements will exist.

    If your conversion table contains lines such as:

    P:CellBody entry cellbody
    TC: entry

    You will get the nested input elements. External is the cell of the table itself and inside is the paragraph. FrameMaker does not have a valid document to use the tag of the element itself to a cell and a container, so aside from the results is not what you wanted, they are not correct in FrameMaker.

    If your table cells contain simple paragraphs and you don't want the elements for cells and paragraphs, your conversion table didn't even need to mention paragraph CellBody and CellHeading tags. Indeed, if your table formats using CellBody as paragraph format for cells in the body of a table and CellHeading as the paragraph format for the cells in the table, your ESD header didn't even apply the paragraph formats.

    Another alternative is to include a paragraph tag in a table row of conversion for a table cell by combining TC: and P: to match table cells containing such paragraphs. For example:

    TC: P:CellBody entry

    creates items named cell entry of table cells containing paragraphs tag CellBody. The paragraph in such a cell is not encapsulated in an extra element.

    One final note is that TH: in a conversion table refers to the position of the entire table. his children are header lines. The analogue of table of TH body: to:, not TC.:

    -Lynne

  • Bulk collect into a Table nested with Extend

    Hi all
    I want to get all the columns of the table emp and dept. So I use bulk collect into the concept of nested table.

    *) I wrote the function in three different ways. EX: 1 and 2 (DM_NESTTAB_BULKCOLLECT_1 & DM_NESTTAB_BULKCOLLECT_2) does not give the desired result.
    *) It only gives the columns of the EMP table. That means it takes DEPT & columns of the EMP table, but it only gives columns of table EMP.
    ) I think, there is something problem with nested table Extend.
    ) I want to know infested.
    Can we use bulk collect into a table nested with extend?
    If it is yes then fix the below codes (EX: 1 & EX: 2) and can you explain me please?


    Codes are given below *.

    CREATE OR REPLACE TYPE NEST_TAB IS TABLE OF THE VARCHAR2 (1000);

    EX: 1:
    ----
    -Bulk collect into a Table nested with Extend-
    CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_1
    RETURN NEST_TAB
    AS
    l_nesttab NEST_TAB: = NEST_TAB();
    BEGIN
    FOR tab_rec IN (SELECT table_name
    From user_tables
    WHERE table_name IN ('EMP', 'Department')) LOOP
    l_nesttab.extend;

    SELECT column_name
    bulk collect INTO l_nesttab
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name
    ORDER BY column_id;
    END LOOP;

    RETURN l_nesttab;
    EXCEPTION
    WHILE OTHERS THEN
    LIFT;
    END DM_NESTTAB_BULKCOLLECT_1;

    SELECT *.
    TABLE (DM_NESTTAB_BULKCOLLECT_1);

    OUTPUT:
    -------
    EMPNO
    ENAME
    JOB
    MGR
    HIREDATE
    SAL
    COMM
    DEPTNO

    * Only the EMP table columns are there in the nested table.
    -----------------------------------------------------------------------------------------------------

    EX: 2:
    -----
    -Bulk collect in the nested with Extend based on County - Table
    CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_2
    RETURN NEST_TAB
    AS
    l_nesttab NEST_TAB: = NEST_TAB();
    v_col_cnt NUMBER;
    BEGIN
    FOR tab_rec IN (SELECT table_name
    From user_tables
    WHERE table_name IN ('EMP', 'Department')) LOOP
    SELECT MAX (column_id)
    IN v_col_cnt
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name;

    l_nesttab. Extend (v_col_cnt);

    SELECT column_name
    bulk collect INTO l_nesttab
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name
    ORDER BY column_id;
    END LOOP;

    RETURN l_nesttab;
    EXCEPTION
    WHILE OTHERS THEN
    LIFT;
    END DM_NESTTAB_BULKCOLLECT_2;

    SELECT *.
    TABLE (DM_NESTTAB_BULKCOLLECT_2);

    OUTPUT:
    -------
    EMPNO
    ENAME
    JOB
    MGR
    HIREDATE
    SAL
    COMM
    DEPTNO

    * Only the EMP table columns are there in the nested table.
    -------------------------------------------------------------------------------------------

    EX: 3:
    -----

    -Collect in bulk in a nested Table to expand aid for loop.
    CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_3
    RETURN NEST_TAB
    AS
    l_nesttab NEST_TAB: = NEST_TAB();
    TYPE local_nest_tab
    THE VARCHAR2 ARRAY (1000);
    l_localnesttab LOCAL_NEST_TAB: = LOCAL_NEST_TAB();
    NUMBER x: = 1;
    BEGIN
    FOR tab_rec IN (SELECT table_name
    From user_tables
    WHERE table_name IN ('EMP', 'Department')) LOOP
    SELECT column_name
    bulk collect INTO l_localnesttab
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name
    ORDER BY column_id;

    BECAUSE me IN 1.l_localnesttab. COUNTING LOOP
    l_nesttab.extend;

    L_NESTTAB (x): = L_LOCALNESTTAB (i);

    x: = x + 1;
    END LOOP;
    END LOOP;

    RETURN l_nesttab;
    EXCEPTION
    WHILE OTHERS THEN
    LIFT;
    END DM_NESTTAB_BULKCOLLECT_3;

    SELECT *.
    TABLE (DM_NESTTAB_BULKCOLLECT_3);

    OUTPUT:
    ------
    DEPTNO
    DNAME
    LOC
    EMPNO
    ENAME
    JOB
    MGR
    HIREDATE
    SAL
    COMM
    DEPTNO

    * Now, I got the desired result set. DEP. and columns of the Emp Table are in the nested Table.




    Thank you
    Ann

    COLLECTION BULK cannot add values to an existing collection. It can only crush.

  • Extract the plsql nested xml attributes

    Hi, I need to extract xml file and insert 2 oracle tables. The xml file is the use of attributes, and I cannot retrieve the element 'code' nested with its attributes in the context of its parent element 'table '. Here is a sample of the xml data that I have to extract the date:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < dataset - cv:dataset - cv dateProduced = "2011-09-19 11:50:45 ' xmlns:dataset - cv ="http://www.myurl.com/dataset-cv/1.0.0">"
    < lov >
    < id of the table = "00000000000001000" Name = "Role of the system" isSystem = "true" status = "Enabled" >
    < id code = "00000000000000306" Name = "Helpdesk" code = "1" status = "Enabled" / >
    < id code = "000000000000000307" Name = "Reviewer" code = "2" status = "Enabled" / >
    < id code = "00000000000000308" Name = 'Administrator' code = '3' status = "Enabled" / >
    < /table >
    < id of the table = "00000000000002000" Name = 'Country' sSystem 'false' status = "Enabled" = >
    < id code = "000000000000002004" Name = "AFGHANISTAN" code = "4" status = "Enabled" / >
    < id code = "000000000000002008" Name = 'ALBANIA' code = '8' status = "Enabled" / >
    < id code = "000000000000002010" Name = "ANTARCTICA" code = "10" status = "Enabled" / >
    < /table >
    < / lov >
    < / dataset - cv:dataset - cv >

    I have tried to use a query like this but does not retrieve the code attributes in the context of his record in the parent table.

    SELECT ID, Name, frenchname, State, code
    FROM XMLTABLE ('for $i //lov//table return $i"
    In PASSING db_get_xml_from_file ("myfile.xml", "XMLORADIR")
    ID VARCHAR2 COLUMNS (32) PATH '@id '.
    , englishName PATH VARCHAR2 (32) "@englishName".
    , frenchName PATH VARCHAR2 (32) "@frenchName".
    , status VARCHAR2 (6) PATH '@status '.
    code VARCHAR2 (6) path "/ / code / / code");

    Any help will be much appreciated

    Thank you

    Dave

    Hi Dave,.

    Do you want something like this:

    SQL> SELECT x1.id
      2       , x1.englishName
      3       , x1.frenchName
      4       , x1.status
      5       , x2.*
      6  FROM XMLTable(
      7         XMLNamespaces('http://www.myurl.com/dataset-cv/1.0.0' as "dc")
      8       , '/dc:dataset-cv/lov/table'
      9         passing xmltype(bfilename('TEST_DIR','myfile.xml'),nls_charset_id('AL32UTF8'))
     10         columns
     11           id          VARCHAR2(32) path '@id'
     12         , englishName VARCHAR2(32) path '@englishName'
     13         , frenchName  VARCHAR2(32) path '@frenchName'
     14         , status      VARCHAR2(6)  path '@status'
     15         , codes       XMLType      path 'code'
     16       ) x1
     17     , XMLTable(
     18         '/code'
     19         passing x1.codes
     20         columns
     21           codeId          VARCHAR2(32) path '@id'
     22         , codeEnglishName VARCHAR2(32) path '@englishName'
     23         , codeStatus      VARCHAR2(6)  path '@status'
     24         , code            NUMBER       path '@code'
     25       ) x2
     26  ;
    
    ID                               ENGLISHNAME                      FRENCHNAME                       STATUS CODEID                           CODEENGLISHNAME                  CODESTATUS       CODE
    -------------------------------- -------------------------------- -------------------------------- ------ -------------------------------- -------------------------------- ---------- ----------
    00000000000001000                System Role                                                       Enable 00000000000000306                Helpdesk                         Enable              1
    00000000000001000                System Role                                                       Enable 000000000000000307               Reviewer                         Enable              2
    00000000000001000                System Role                                                       Enable 00000000000000308                Administrator                    Enable              3
    00000000000002000                Country                                                           Enable 000000000000002004               AFGHANISTAN                      Enable              4
    00000000000002000                Country                                                           Enable 000000000000002008               ALBANIA                          Enable              8
    00000000000002000                Country                                                           Enable 000000000000002010               ANTARCTICA                       Enable             10
    
    6 rows selected
     
    
  • Assistance in creation of objects Table nested in a column

    Hi all

    In our project requirement, we are supposed to create a table1 consisting of such object1 of the column and Object1 has a nested object (object2) as one of the column.

    We are able to create the table (table-name is op_sam) for object1

    create or replace type testobj1 as an object (number of c1, c2 number);
    create or replace type t_testobj in the testobj1 table;

    create table op_sam (obj_id varchar2 (100), workobj t_testobj)
    store workobj table nested as nested_tab back as a value;

    We strive to store op_sam as an object in an another table prepop

    We have created the object for the op_sam

    create or replace type op_sam_obj as an object (obj_id varchar2 (100), workobj t_testobj);
    create or replace type t_op_sam_obj in the op_sam_obj table;



    We gave the following script to create the table with the column as t_op_sam_obj

    create table prepop (ob_id varchar2 (20), t_op_sam_obj object2)
    nested table object2 store like nested_tab1 back as a value;


    ORA-22913: must specify the name of the table for the nested table column or attribute · nested tables ·

    could you please suggest me to fix this?

    Hello

    Each object of type table needs a nested table.
    Subject: object2 has a nested table object: workobj
    Then, who also has a nested table clause.

    CREATE
         TABLE prepop
         (
              ob_id VARCHAR2(20)
         , object2 t_op_sam_obj
         )
         nested TABLE object2 store AS nested_tab1
         (
              nested TABLE workobj store AS nested_tab2
         )
            return as value
    ;
    

    This will create 3 tables:
    nested_tab2 as an embedded table
    nested_tab1 as an embedded table
    prepop

    Kind regards

    Peter

Maybe you are looking for

  • I was hacked and the apple support is inaccessible

    I can't get my hands on apple and someone from China hacked my account. They bought things and changed my security questions, so I can't change anything. I need help!

  • EliteBook 2530p. Can not turn on WiFi Windows 10

    EliteBook 2530p, Windows 10 home Ive just upgraded the machine above 10 win 10 with the help of this site. Everything works fine except one thing, I can not turn on WiFi. The orange LED on the touch screen under the screen and the front edge of the m

  • Menu print freezes on HP Officejet 6700

    I do a lot of printing to our company. Most of what I need to print comes from the nternet thei on paper of the 'statement' of size. About 4 weeks ago we had to buy a new printer and I got the HP 6700 Premium Offficejet. When I start my impression I

  • Log in time

    Journal of the computer at the time is too short.  How to extend time on windows 8?

  • Is it possible to recover the contents of the bbm message

    Hello Can I retrieve contents of message/conversation bbm phone blackberry using an API?