I've got a nested table issue..

Okay, first off: in Oracle 9i is there an option to nest a table inside a nested table? I got the impression it is an option; & I'd like further info on this.
..& on to the issue I've got: I've got one nested table object that I've identified in the following way:
Create Type InnerNestedTable_ty as Object (
ID Number(10),
InnerNestedTableField Number(10)
Create Type InnerNestedTable_tab as Table of InnerNestedTable_ty;
If I were only going to nest this inside of one outer table, I'd input the following (I guess):
Create Table Info (
ID Number(10),
OuterTableField InnerNestedTable_tab
Nested Table OuterTableField Store as InnerNestedTable_ntab;
Only thing is I'd like to nest this inside a nested table, in a field of an outer table (i.e., I'm going for a nested nested table, in other words). I guess I need the code to input in order for this to occur. For example, the outer table would be called OuterTable, the field would be OuterTableField. In that field I'd like a nested table [OuterNestedTable_ty, OuterNestedTable_tab] with the fields ID & OuterNestedTableField. The OuterNestedTableField field is to be a nested table itself [InnerNestedTable_ty, InnerNestedTable_tab]. I've got the latter, but no idea Long postings are being truncated to ~1 kB at this time.

Noel,
You can check out examples in the online doc at http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96594/adobjbas.htm#462243.
Regards,
Geoff

Similar Messages

  • Nested table issue.

    Hi All,
    my oracle version is
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE     11.1.0.6.0     Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    i have created 2 types
    lets say Typ_a , Typ_B
    this 2 types used in Table_A
    create table Table_A
    RNo number,
    Rname Varchar2(50),
    Typ1 Typ_a,
    Typ2 Typ_b
    NESTED TABLE Typ1 STORE AS Typ_adata,
    NESTED TABLE Typ2 STORE AS Typ_Bdata ;
    Now i want to use same types in my other tables.
    is it possible ??
    i got following error
    ORA-02320: failure in creating storage table for nested table column Typ1
    ORA-22913: must specify table name for nested table column or attribute.

    Yes. But you need to change the "segment" name where the data gets stored:
    CREATE OR REPLACE TYPE Typ_a AS TABLE OF VARCHAR2(30);
    CREATE OR REPLACE TYPE Typ_b AS TABLE OF NUMBER(2);
    create table Table_A
    RNo number,
    Rname Varchar2(50),
    Typ1 Typ_a,
    Typ2 Typ_b
    NESTED TABLE Typ1 STORE AS Typ_adata,
    NESTED TABLE Typ2 STORE AS Typ_Bdata;
    create table Table_B
    RNo number,
    Rname Varchar2(50),
    Typ1 Typ_a,
    Typ2 Typ_b
    NESTED TABLE Typ1 STORE AS Typ_adata2,
    NESTED TABLE Typ2 STORE AS Typ_Bdata2;
    select * from user_segments where segment_name like 'TYP_%';
    SEGMENT_NAME                                                                      SEGMENT_TYPE      
    TYP_ADATA                                                                         NESTED TABLE      
    TYP_ADATA2                                                                        NESTED TABLE      
    TYP_BDATA                                                                         NESTED TABLE      
    TYP_BDATA2                                                                        NESTED TABLE       -- andy

  • Issues with Nested Tables and Adobe Designer

    Hi,
    I have some strange issues when I am trying to create a nested dynamic table with SAP DATA in Adobe Designer.
    My Outer Table has article items and in this table I got a nested charges. For instance the table contains this data:
    DATA
    |->Article1
    |--->charge111
    |--->charge211
    |
    |->Article2
    |--->charge122
    |--->charge222
    Now I am trying to display the data in a Adobe Designer table. But if I create a table with a row article and a repeating row charge all charges will be displayed under the first Article.
    This is the result:
    DATA
    |->Article1
    |--->charge111
    |--->charge211
    |--->charge122
    |--->charge222
    |
    |->Article2
    How can I solve this issue? I tried to select data binding on charges like article.DATA.charges.DATA[*] but this don't work.
    Anyone an idea?

    Alex,
    Is it print based form or interactvie form.
    ABAP
    If it is printbased form and if you are designing from SFP, you can use the following solution.
    You have to create a nested table in the context as below.
    say Table1-> Article ( fields: ARTICLENAME,....other fields) info Table2->cost info(fields:ARTICLENAME,Charge...,other fields).
    The 2 tables should contains data as beow.
    Table1 data.
    1row->Article1  -.....other values.
    2row->Article2  -.....other values.
    3row->Article3  -.....other values.
    Table2 data.
    1row->Article1  -Charge11 .....other values.
    2row->Article1  -Charge12 .....other values.
    3row->Article1  -Charge13 .....other values.
    4row->Article2  -Charge21 .....other values.
    5row->Article2  -Charge22 .....other values.
    6row->Article2  -Charge23 .....other values.
    7row->Article3  -Charge31 .....other values.
    8row->Article3  -Charge32 .....other values.
    9row->Article3  -Charge33 .....other values.
    In the context drag table2 into the table1 and define where clause on ARTICLENAME.
    In the layout drag nested table in the body page and make alignments.
    If your requirement is interactive, may be you can use the similar logic.

  • 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 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

  • Data pump import error with nested tables

    So the problem is somewhat long :)
    Actually the problems are two - why and how oracle are treating OO concept and why data pump doesn't work?
    So scenario for the 1st one:
    1) there is object type h1 and table of h1
    2) there is unrelated object type row_text and table of row_text
    3) there is object type h2 under h1 with attribute as table of row_text
    4) there is table tab1 with column b with data type as table of h1. Of course column b is stored as nested table.
    So how do you think - how many nested tables Oracle will create? The correct answer is 2. One explicitly defined and one hidden with system
    generated name for the type h2 which is under type h1. So the question is WHY? Why if I create an instance of supertype Oracle tries to adapt
    it for the subtype as well? Even more if I create another subtype h3 under h1 another hidden nested table appears.
    This was the first part.
    The second part is - if I do schema export and try to import it in another schema I got error saying that oracle failed to create storage table for
    nested table column b. So the second question is - if Oracle has created such a mess with hidden nested tables how to import/export to another
    schema?
    Ok and here is test case to demonstrate problems above:
    -- creating type h1 and table of it
    SQL> create or replace type h1 as object (a number)
      2  not final;
      3  /
    Type created.
    SQL> create or replace type tbl_h1 as table of h1;
      2  /
    Type created.
    -- creating type row_text and table of it
    SQL> create or replace type row_text as object (
      2    txt varchar2(100))
      3  not final;
      4  /
    Type created.
    SQL> create or replace type tbl_row_text as table of row_text;
      2  /
    Type created.
    -- creating type h2 as subtype of h1
    SQL> create or replace type h2 under h1 (some_texts tbl_row_text);
      2  /
    Type created.
    SQL> create table tab1 (a number, b tbl_h1)
      2  nested table b
      3  store as tab1_nested;
    Table created.
    -- so we have 2 nested tables now
    SQL> select table_name, parent_table_name, parent_table_column
      2  from user_nested_tables;
    TABLE_NAME                     PARENT_TABLE_NAME
    PARENT_TABLE_COLUMN
    SYSNTfsl/+pzu3+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"
    TAB1_NESTED                    TAB1
    B
    -- another subtype of t1
    SQL> create or replace type h3 under h1 (some_texts tbl_row_text);
      2  /
    Type created.
    -- plus another nested table
    SQL> select table_name, parent_table_name, parent_table_column
      2  from user_nested_tables;
    TABLE_NAME                     PARENT_TABLE_NAME
    PARENT_TABLE_COLUMN
    SYSNTfsl/+pzu3+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"
    SYSNTfsl/+pz03+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H3")."SOME_TEXTS"
    TAB1_NESTED                    TAB1
    B
    SQL> desc "SYSNTfsl/+pzu3+jgQAB/AQB27g=="
    Name                                      Null?    Type
    TXT                                                VARCHAR2(100)OK let it be and now I'm trying to export and import in another schema:
    [oracle@xxx]$ expdp gints/xxx@xxx directory=xxx dumpfile=gints.dmp logfile=gints.log
    Export: Release 11.2.0.1.0 - Production on Thu Feb 4 22:32:48 2010
    <irrelevant rows skipped>
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    . . exported "GINTS"."TAB1"                                  0 KB       0 rows
    . . exported "GINTS"."SYSNTfsl/+pz03+jgQAB/AQB27g=="         0 KB       0 rows
    . . exported "GINTS"."TAB1_NESTED"                           0 KB       0 rows
    . . exported "GINTS"."SYSNTfsl/+pzu3+jgQAB/AQB27g=="         0 KB       0 rows
    Master table "GINTS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
    ******************************************************************************And now import. In order to create types transformation of OIDs is applied and also remap_schema
    Although it fails to create the table.
    [oracle@xxx]$ impdp gints1/xxx@xxx directory=xxx dumpfile=gints.dmp logfile=gints_imp.log remap_schema=gints:gints1 transform=OID:n
    Import: Release 11.2.0.1.0 - Production on Thu Feb 4 22:41:48 2010
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Release 11.2.0.1.0 - Production
    Master table "GINTS1"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
    Starting "GINTS1"."SYS_IMPORT_FULL_01":  gints1/********@xxx directory=xxx dumpfile=gints.dmp logfile=gints_imp.log remap_schema=gints:gints1 transform=OID:n
    Processing object type SCHEMA_EXPORT/USER
    ORA-31684: Object type USER:"GINTS1" already exists
    Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
    Processing object type SCHEMA_EXPORT/ROLE_GRANT
    Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
    Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    ORA-39083: Object type TABLE:"GINTS1"."TAB1" failed to create with error:
    ORA-02320: failure in creating storage table for nested table column B
    ORA-00904: : invalid identifier
    Failing sql is:
    CREATE TABLE "GINTS1"."TAB1" ("A" NUMBER, "B" "GINTS1"."TBL_H1" ) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    ORA-39083: Object type INDEX_STATISTICS failed to create with error:
    ORA-01403: no data found
    ORA-01403: no data found
    Failing sql is:
    DECLARE I_N VARCHAR2(60);   I_O VARCHAR2(60);   c DBMS_METADATA.T_VAR_COLL;   df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS'; BEGIN  DELETE FROM "SYS"."IMPDP_STATS";   c(1) :=   DBMS_METADATA.GET_STAT_COLNAME('GINTS1','TAB1_NESTED',NULL,'TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"',1);  DBMS_METADATA.GET_STAT_INDNAME('GINTS1','TAB1_NESTED',c,1,i_o,i_n);   INSERT INTO "
    ORA-39083: Object type INDEX_STATISTICS failed to create with error:
    ORA-01403: no data found
    ORA-01403: no data found
    Failing sql is:
    DECLARE I_N VARCHAR2(60);   I_O VARCHAR2(60);   c DBMS_METADATA.T_VAR_COLL;   df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS'; BEGIN  DELETE FROM "SYS"."IMPDP_STATS";   c(1) :=   DBMS_METADATA.GET_STAT_COLNAME('GINTS1','TAB1_NESTED',NULL,'TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H3")."SOME_TEXTS"',1);  DBMS_METADATA.GET_STAT_INDNAME('GINTS1','TAB1_NESTED',c,1,i_o,i_n);   INSERT INTO "
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    Job "GINTS1"."SYS_IMPORT_FULL_01" completed with 4 error(s) at 22:41:52So any idea how to make export/import of such tables?
    TIA
    Gints

    Tom Kyte has said it repeatedly ... I will repeat it here for you.
    The fact that Oracle allows you to build object tables is not an indication that you should.
    Store your data relationally and build object_views on top of them.
    http://www.morganslibrary.org/reference/object_views.html
    If you model properly, and store properly, you don' have any issues.

  • 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>

  • 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 tables and multiset operators in Oracle 10g

    Consider the following scenario:
    We have two identical relations R and S defined as:
    CREATE TABLE R(
    a INTEGER,
    b table_type)
    NESTED TABLE b STORE as b_1;
    CREATE TABLE S(
    a INTEGER,
    b table_type)
    NESTED TABLE b STORE as b_2;
    where table_typ is defined as
    CREATE TYPE table_typ AS TABLE OF VARCHAR2(8);
    Suppose we have two instances of R and S, each having one tuple as follows: R(1,table_typ('a','b')) and S(1,table_typ('b','c')).
    I would like to "merge" these two simple instances (e.g., achieve the effect of a simple SELECT * FROM R UNION SELECT * FROM S query) and obtain the following resulting instance: Result(1,table_typ('a','b','c')).
    Would this be possible in Oracle 10g? A simple UNION does not work (I got a "inconsistent datatypes: expected - got SCOTT.TABLE_TYP" error). I also took a look at the MULTISET UNION operator over nested tables available in Oracle 10g, but it doesn't seem to get me anywhere. Any help on this would be greatly appreciated.
    Thank you,
    Laura

    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>

  • Nested tables in RTF templates

    Hi,
    I've developed several templates including nested tables(to display parent/child transactions together in a single column group, displaying all the detail transactions but the parent only once), in PDF output this looks fine. However the users want all their output in Excel, this same layout is not picked up by Excel(all column headers for the data in the nested table move to the right, while all the data in the nested table is grouped under a 'merged cell' column header). Output of BI Publisher reports in Excel is generally terrible with a template designed for publishing in PDF, usually I can solve this with a lot of tweaking but haven't found a solution for this issue yet. Has anyone else run into this formatting issue and may have a tip to solve this?
    Regards,
    Arthur

    Hi,
    You need to declare a TYPE object as and then use it in the table structure.
    CREATE TYPE type_emp IS TABLE OF VARCHAR2(15);
    CREATE TABLE Biscuits Company SA
    (company_name COMPANY NOT NULL,
    Company_Owner VARCHAR2(20) NOT NULL)
    NESTED TABLE staff_tab STORE AS type_emp;
    Please see the link for more info.
    http://www.developer.com/db/article.php/10920_3379271_3
    Thanks

  • Page break on nested table

    Hi,
    I am getting blank page because of page break after nested table.
    When page is full with the records then because of nested table, it added one space after that.
    Has anyone faced this issue before?
    Thanks

    Hi,
    Upload the .rtf template and XML sample so we can see your issue.
    Also I recommend you to review our page-break document:
    http://docs.oracle.com/cd/E28280_01/bi.1111/e22254/create_rtf_tmpl.htm#BIPRD2457
    Regards,
    Liviu

  • Problem in creating a nested table

    Hi i am working on Oracle 10g and cleint is sqlplus.
    Now while creating a nested table following error occured.
    This is the script for your reference.:
    CREATE OR REPLACE TYPE sec_pwd_hist_table
    AS
    TABLE OF sec_pwd_history_type
    index by binary_integer
    Warning: Type created with compilation errors.
    SQL> show error
    Errors for TYPE SEC_PWD_HIST_TABLE:
    LINE/COL ERROR
    0/0      PL/SQL: Compilation unit analysis terminated
    3/1      PLS-00355: use of pl/sql table not allowed in this context
    Please help on this issue
    Regards,
    Vikas Kumar

    > but i want to know just one thing why its working when i am removing "INDEX BY binaty_integer"
    Vikas, I trust I answered that question when I said? :
    "Do not confuse the two. Do not attempt to use PL/SQL array struct definition syntax in the SQL engine for defining an ADT collection. Which is why I referred you to the manual to see how an ADT is defined in SQL."
    In other words, you are trying to apply a PL/SQL concept and PL/SQL syntax to a definition of a data type in SQL.
    SQL is not PL/SQL.
    SQL ADTs are not PL/SQL arrays/tables.
    It is not even a syntax issue - it is a basic concept issue. SQL does not support PL/SQL arrays/tables. Period.

  • Partitioned nested table error while dropping one partition

    All,
    I created a partitioned table which is also a nested table as you can see below. I got FK constraint error while attempting to drop a partition, however, I could not find the FK in order to disable it since it's underlying table emp_list_p which is not visiable to applications. How could I drop the partition in this case?
    Thanks,
    Jianhui
    SQL>desc emp_t
    Name Null? Type
    ENO NUMBER
    ENAME VARCHAR2(30)
    SAL NUMBER
    SQL>desc emp_list_t
    emp_list_t TABLE OF EMP_T
    Name Null? Type
    ENO NUMBER
    ENAME VARCHAR2(30)
    SAL NUMBER
    SQL>l
    1 create table dept_p
    2 (dno number,
    3 dname varchar2(30),
    4 emplist emp_list_t )
    5 NESTED TABLE emplist store as emp_list_p
    6 partition by range (dno)
    7 (
    8 partition p1 values less than (2),
    9 partition p2 values less than (3)
    10* )
    SQL>/
    Table created.
    SQL>insert into dept_p (select * from dept);
    2 rows created.
    SQL>select * from dept_p;
    DNO DNAME
    EMPLIST(ENO, ENAME, SAL)
    1 HR
    EMP_LIST_T(EMP_T(1, 'scott', 1000), EMP_T(2, 'brain', 2000))
    2 SALES
    EMP_LIST_T(EMP_T(3, 'frank', 800))
    2 rows selected.
    SQL>alter table dept_p drop partition p1;
    alter table dept_p drop partition p1
    ERROR at line 1:
    ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    SQL>l
    1 select constraint_name, constraint_type, table_name
    2 from user_constraints
    3 where r_constraint_name=(select constraint_name
    4* from user_constraints where table_name='DEPT_P' and constraint_type in ('P','U'))
    SQL>/
    no rows selected

    SQL> create type emp_t as object(
      2  ENO NUMBER,
      3  ENAME VARCHAR2(30),
      4  SAL NUMBER)
      5  /
    Type created.
    SQL> create type emp_list_t as table of emp_t;
      2  /
    Type created.
    SQL> desc emp_list_t
    emp_list_t TABLE OF EMP_T
    Name                                      Null?    Type
    ENO                                                NUMBER
    ENAME                                              VARCHAR2(30)
    SAL                                                NUMBER
    SQL> create table dept_p
      2  (dno number,
      3  dname varchar2(30),
      4  emplist emp_list_t )
      5  NESTED TABLE emplist store as emp_list_p
      6  partition by range (dno)
      7   (
      8   partition p1 values less than (2),
      9   partition p2 values less than (3)
    10   )
    11  /
    Table created.
    SQL> insert into dept_p values(1, 'HR',
      2  EMP_LIST_T(EMP_T(1, 'scott', 1000), EMP_T(2, 'brain', 2000)));
    1 row created.
    SQL>
    SQL> insert into dept_p values(2, 'SALES',EMP_LIST_T(EMP_T(3, 'frank', 800)));
    1 row created.
    SQL> select * from dept_p;
           DNO DNAME
    EMPLIST(ENO, ENAME, SAL)
             1 HR
    EMP_LIST_T(EMP_T(1, 'scott', 1000), EMP_T(2, 'brain', 2000))
             2 SALES
    EMP_LIST_T(EMP_T(3, 'frank', 800))
    SQL> alter table dept_p drop partition p1;
    alter table dept_p drop partition p1
    ERROR at line 1:
    ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    SQL> select constraint_name,table_name,constraint_type from user_constraints
      2  where table_name = 'DEPT_P';
    CONSTRAINT_NAME                TABLE_NAME                     C
    SYS_C008224                    DEPT_P                         U
    SQL> select index_name from user_constraints
      2  where table_name = 'DEPT_P';
    INDEX_NAME
    SYS_C008224
    SQL> select index_name,column_name from user_ind_columns
      2  where index_name = 'SYS_C008224';
    INDEX_NAME                     COLUMN_NAME
    SYS_C008224                    EMPLIST
    SQL>
    SQL> disconnect
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
    With the Partitioning, OLAP and Data Mining options
    If you look closely, there is a unique index on dept_p.  Oracle does not advertise it.
    One of the options is that you may have to delete the rows in the partition first,
    then drop the partition.

  • Error while mapping two times nested table

    Hi,
    I have a Product table which has nested ProductSubcategory in it.
    ProductSubcategory nested table also has nested table ProductCategory inside it.
    So there is a nested table inside nested table.
    I designed a dimension on warehoue builder and while mapping, i got "ORA-22913: must specify table name for nested table column or attribute" error.
    I mapped nested tables before with using varray iterator and expand object, but they were nested once. Is there any solution for mapping two or more time nested tables?
    Now i exracted tables and i continuou working but, i wondered is there any way.
    Creation codes are below. Thanx :)
    CREATE TABLE PRODUCT
    (     PRODUCTID NUMBER NOT NULL ,
         ProductSubcategory ProductSubcategory,
         MODIFIEDDATE DATE NOT NULL)
    NESTED TABLE ProductSubcategory STORE AS ProductSubcategory_TABLE
    ( NESTED TABLE ProductCategoryId STORE AS ProductCategory_TABLE);
    CREATE TYPE TYPE_ProductSubcategory AS OBJECT (
         ProductSubcategoryID number ,
         ProductCategoryId ProductCategory ,
         Name Varchar(50) ,
         rowguid varchar2(100) ,
         ModifiedDate date );
    CREATE TYPE TYPE_ProductCategory AS OBJECT (
         ProductCategoryID number ,
         Name Varchar(50) ,
         rowguid varchar2(100) ,
         ModifiedDate date );

    Bharadwaj Hari wrote:
    Hi,
    I agree with u...I am not sure of the environment the user has so i put forth all the 3 option that crossed my mind that time....thats why i said he has to choose what best suits him/her...
    Also if the database is huge and we create physical temp tables (option 2 and ur idea) its like having redundant data in the database which is also a problem....So ist upto the user to actually evaluate the situation and come up with what best suits him/her...
    Regards
    BharathHi,
    I understand your opinion. But I am not sure that the user have enough experience to choose the best option by his one. And about the redundant data: because of this I wrote that he should truncate the tables after the last mapping which loads all data into the real target table.
    Regards,
    Detlef

  • Inserting data with the help of nested table...!!!

    The following block is giving error
    ORA-06502: PL/SQL: numeric or value error
    the signature and signature_bkp have the same structure
    So, can anybody help me out to solve this issue :
    for copying records from one table to another table
    Thanking You advancely
    DECLARE
    CURSOR c1
    IS
    SELECT *
    FROM signature
    WHERE creation_time > TRUNC ( SYSDATE ) - 100
    AND ROWNUM < 102;
    TYPE sig_typ IS TABLE OF signature%ROWTYPE;
    sig_t sig_typ;
    BEGIN
    OPEN c1;
    FETCH c1
    BULK COLLECT INTO sig_t;
    CLOSE c1;
    FORALL i IN sig_t.FIRST .. sig_t.LAST
    INSERT INTO signature_bkp
    VALUES sig_t ( i );
    COMMIT;
    END;
    --DKar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Or whether a INSERT statement with SELECT clause will do that for youby using this technique, it took 47:08:45 to copy 7252 rows
    and by using a cursor for loop took 49:03:23 to copy 13567 rows
    So there was appox. 40% increase in performance by using pl/sql. I thought it could be even faster using the bulk-bind ing features and nested tables.
    OR i just want to know ....how to correct the block of code that was given in my 1st msg without changing its logic.
    Thanks
    --DKar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • How do I add the channel-name to mixed signals?

    Hello, I want to save a XY-Signal to a tdm-File and import it into DIAdem. So I merged the X- with the Y-Signal and connect the merged-signal to the "Write To Measurement File" VI. In DIAdem I can see both signals but their name are "Untitled" and "U

  • Laptop search criteria

    I have been looking at getting a new laptop and have been browsing bestbuy.com for the last couple months. Up until the last couple of weeks if I selected processor brand of Intel, then the site would present me with the ability to choose which type

  • How do I get Flash Player unblocked

    how do I get Flash player to work?

  • Formula calculation in a variable

    hi sir i have a table name is calculation and it is below as CAL_ID CARCHAR2(20), CAL_FORMULA(100); cal_id cal_formula CL0001 AMOUNT+(TAX*12%) CL0002 AMOUNT+(VAT*6%) AMOUNT, TAX, VAT and SAMOUNT are variable on my form i m using form 6i and oracle 8i

  • Problem in rendering dashboard

    Hello, Here is a screenshot of my dashbord. I think there is some rendering issue. Can anyone help me with this. Thanks