Adding nested table to object table

if I alter an object type and add a nested table to it, there seem to be no syntax to add "STORE AS" clause for that nested table in the object table containing the altered object type. E.G.:
ALTER TYPE fd_dao ADD ATTRIBUTE Own_Name Own_Name_ntt;
where Own_Name_ntt is a nested table type, then
ALTER TABLE FD_DOT NESTED TABLE Own_Name STORE AS Own_Name_ntab;
does not work but the table FD_DOT can not be used since it lacks the storage for the newly added nested table.

Check your syntax.
CREATE TYPE Own_Name_ntt AS TABLE OF VARCHAR2(25);
CREATE TYPE fd_dao AS OBJECT
(col1        date
,col2        number);
CREATE TABLE fd_dot(cola varchar2(10)
                   ,colb date);
ALTER TYPE fd_dao ADD ATTRIBUTE Own_Name Own_Name_ntt;
ALTER TABLE FD_DOT ADD (Own_Name Own_Name_ntt)
    NESTED TABLE Own_Name STORE AS Own_Name_ntab;
SQL> CREATE TYPE Own_Name_ntt AS TABLE OF VARCHAR2(25);
  2  /
Type created.
SQL>
SQL> CREATE TYPE fd_dao AS OBJECT
  2   (col1        date
  3   ,col2        number);
  4  /
Type created.
SQL>
SQL> CREATE TABLE fd_dot(cola varchar2(10)
  2                     ,colb date);
Table created.
SQL>
SQL> ALTER TYPE fd_dao ADD ATTRIBUTE Own_Name Own_Name_ntt;
Type altered.
SQL>
SQL> ALTER TABLE FD_DOT ADD (Own_Name Own_Name_ntt)
  2      NESTED TABLE Own_Name STORE AS Own_Name_ntab;
Table altered.
SQL> desc fd_dot
Name                                                                          Null?    Type
COLA                                                                                   VARCHAR2(10)
COLB                                                                                   DATE
OWN_NAME                                                                               OWN_NAME_NTT
SQL> desc fd_dao
Name                                                                          Null?    Type
COL1                                                                                   DATE
COL2                                                                                   NUMBER
OWN_NAME                                                                               OWN_NAME_NTT
SQL> disconnect
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining options
SQL> CREATE TYPE Own_Name_ntt AS TABLE OF VARCHAR2(25);
  2  /
Type created.
SQL>
SQL> CREATE TYPE fd_dao AS OBJECT
  2   (col1        date
  3   ,col2        number);
  4  /
Type created.
SQL>
SQL> CREATE TABLE fd_dot(cola varchar2(10)
  2                     ,colb date);
Table created.
SQL>
SQL> ALTER TYPE fd_dao ADD ATTRIBUTE Own_Name Own_Name_ntt;
Type altered.
SQL>
SQL> ALTER TABLE FD_DOT ADD (Own_Name Own_Name_ntt)
  2      NESTED TABLE Own_Name STORE AS Own_Name_ntab;
Table altered.
SQL> desc fd_dao
Name                                                                          Null?    Type
COL1                                                                                   DATE
COL2                                                                                   NUMBER
OWN_NAME                                                                               OWN_NAME_NTT
SQL> desc fd_dot
Name                                                                          Null?    Type
COLA                                                                                   VARCHAR2(10)
COLB                                                                                   DATE
OWN_NAME                                                                               OWN_NAME_NTT
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.3.0 - Production

Similar Messages

  • How to cast RECORD of nested tables into OBJECT of nested tables

    Right, we have an existing massive pl/sql package where some of the processing is taking too long so they want to try multithreading it.
    The data in this package is stored in an array of records which contains nested tables, which themselves contain nested tables.
    So, we want to split this table into 10, and submit them to 10 dbms_jobs to run concurrently, write the modified arrays to the database so they can be picked up again by the original process.
    I'm stuck on converting the associative array of data (containing tables of records) into objects which can be stored in the DB.
    My database objects:
    CREATE OR REPLACE
    TYPE ktest_claims_rt IS OBJECT
         col1 varchar2(10)
        ,col2 varchar2(10));
    CREATE OR REPLACE
      TYPE ktest_claims_tt IS TABLE OF ktest_claims_rt;
    CREATE OR REPLACE
    TYPE ktest_driver_rt IS OBJECT
         col1      varchar2(10)
        ,col2      varchar2(10)
        ,claims_nt ktest_claims_tt);
    CREATE OR REPLACE
      TYPE ktest_driver_tt IS TABLE OF ktest_driver_rt;
    CREATE OR REPLACE
    TYPE ktest_policy_rt IS OBJECT
         col1       varchar2(10)
        ,col2       varchar2(10)
        ,driver_nt  ktest_driver_tt);
    CREATE OR REPLACE
      TYPE ktest_policy_tt IS TABLE OF ktest_policy_rt;
    CREATE TABLE ktest_job_table
      (job_no        NUMBER
      ,tab_type      VARCHAR2(3)
      ,policy_nt     ktest_policy_tt
      NESTED TABLE policy_nt STORE AS policy_nested_tab
        (NESTED TABLE driver_nt STORE AS driver_nested_tab
           (NESTED TABLE claims_nt STORE AS claims_nested_tab))
    / And my local package versions:
       TYPE claims_rt IS RECORD
         col1 varchar2(10)
        ,col2 varchar2(10));
       TYPE claims_tt IS TABLE OF claims_rt INDEX BY PLS_INTEGER;
       TYPE driver_rt IS RECORD
         col1       varchar2(10)
        ,col2       varchar2(10)
        ,claims_nt  claims_tt);
       TYPE driver_tt IS TABLE OF driver_rt INDEX BY VARCHAR2(20);
       TYPE policy_rt IS RECORD
            policy_no   policy.policy_no%TYPE
           ,driver_tab  driver_tt
           ,other_col   VARCHAR2(20));
       TYPE policy_tt IS TABLE OF policy_rt
            INDEX BY pls_integer;
       main_table  policy_tt;What I can't get through my pea sized brain is how to turn "main_table" into an array based on ktest_policy_tt.
    I got as far as:
       FUNCTION convert (p_table IN policy_tt) RETURN ktest_policy_tt
       IS
          db_vers  ktest_policy_tt := ktest_policy_tt();
          db_rec   ktest_policy_rt;
       BEGIN
          FOR i IN p_table.FIRST..p_table.LAST
          LOOP
             db_rec := ktest_policy_rt(p_table(i).policy_no
                                      ,p_table(i).other_col
                                      ,ktest_driver_tt(p_table(i).driver_tab(i).col1
                                                      ,p_table(i).driver_tab(i).col2
                                                      ,ktest_claims_tt(p_table(i).driver_tab(i).claims_nt(i).col1
                                                                      ,p_table(i).driver_tab(i).claims_nt(i).col1
             db_vers(i) := db_rec;
          END LOOP;
       END;but, apart from the fact that it only coverts the first row of each table, it doesn't compile:
    LINE/COL ERROR
    139/10   PL/SQL: Statement ignored
    143/52   PLS-00306: wrong number or types of arguments in call to
             'KTEST_CLAIMS_TT'
    143/52   PLS-00306: wrong number or types of arguments in call to
             'KTEST_CLAIMS_TT'I'd appreciate any help as this is getting urgent.
    Thanks!

    I would recommend writing your function in a more stepwise, explicit fashion rather than trying to write the conversion as basically one big constructor.
    Firstly, you will require nested loops in your pl/sql code for the different levels of nested tables. This is not a choice, you need to do this.
    Within each level of looping, explicitly create the object of the desired type before adding it to the table / record as need be.
    cheers,
    Anthony

  • How to use nested tables object in oracle form

    Hello forum
    How all r u ..
    i need ur help guys, pls help me out...
    i m using an object oriented approach to design my database by using nested tables and
    varrays. it is quite done successfully.
    but the problem is when i m trying to use that object of nested table into the datablock of the form it is not been added to item list of that block.
    so what is the proper way to use these type of objects to the form.
    all ideas are welcomed and vry much required.
    pls give example if possible so easy to understand or have any demo form related to above case then pls post me to my id i.e [email protected]
    thank u all and expecting some expert solutions

    Hello Francois Degrelle...
    How r u doing ... i have searched the forum abt the above mentioned topic then i found that u have some demo form which will help out to explain the functionality of the nested table in forms ..
    will u pls me that form to my i.e [email protected] pls mail all the detail u have regarding using nested tables to forms and reports
    lots of thanks to u n advance.

  • Building an object of nested table types

    Hi,
    Looking for suggestions for the following.
    I have a procedure with 4 table types.
    They are in a hierarchical order so that 4 is the child of 3, 3 is the child of 2 and 2 is the child of 1.
    One of the columns of table 1 is a table type holding all the child records from table 2,
    One of the columns of table 2 is a table type holding all the child records from table 3,
    One of the columns of table 3 is a table type holding all the child records from table 4,
    I have 4 cursors that pull out all of the data to populate each of my 4 table types.
    I am trying to figure out how to nest my fetches to populate all of my table types to create a single object that hold all of my data.
    It’s a table of a table of a table of a table.
    Column 3 of table 1 holds table 2
    Column 3 of table 2 holds table 3
    Column 3 of table 3 holds table 4
    I’ve tried creating my procedure like this (pseudo code)
    declare
    tab_1 tab_1_type;
    tab_2 tab_2_type;
    tab_3 tab_3_type;
    tab_4 tab_4_type;
    cursor get_tab_1 is
    select col1, col2, tab_2 – added the table type for the child records
    from data_table_1
    cursor get_tab_2(tab_1_pk in number) is
    select col1, col2, tab_3 – added the table type for the child records
    from data_table_2
    where tab_2_fk = tab_1_pk
    cursor get_tab_3(tab_2_pk in number) is
    select col1, col2, tab_4 – added the table type for the child records
    from data_table_3
    where tab_3_fk = tab_2_pk
    cursor get_tab_4(tab_3_pk in number) is
    select col1, col2, col3
    from data_table_4
    where tab_4_fk = tab_3_pk
    begin
    open get_tab_1;
    loop
    open get_tab_2
    loop
    open get_tab_3
    loop
    open get_tab_4(tab_3_pk);
    bulk collect get_tab_4 into tab_4;
    close get_tab_4;
    fetch get_tab_3 into tab_3;
    tab_4:= null;
    exit when get_tab_3 %notfound;
    end loop;
    close get_tab_3;
    fetch get_tab_2 into tab_2;
    tab_3:= null;
    exit when get_tab_2 %notfound;
    end loop;
    close get_tab_2;
    fetch get_tab_1 into tab_1;
    tab_3:= null;
    exit when get_tab_1 %notfound;
    end loop;
    close get_tab_1;
    l_return := tab_1;
    end;
    The above won’t work because once the cursor is opened the child tables will be assigned values of null before they have had a chance to populate from the nested fetches.
    It’s almost as if I need to execute the fetch and update the extra columns afterwards somehow, something like:
    fetch get_tab_3 into tab_3;
    tab_3.col3 := tab_4;
    tab_4 := null;
    end loop;
    close get_tab_3;
    can I do that?
    Also the above seems very cumbersome. If there is a more elegant way of building up this object I’d like to hear it.
    Cheers
    Yog

    Interesting little exercise getting a 3 deep nested structure using a single SQL. Below is my attempt. You should be able to run it in any schema that has CREATE TYPE privs.
    SQL> -- Nested structure design:
    SQL> --
    SQL> -- USER LIST = (
    SQL> -- (USER1,OBJECT_LIST1).., (USERn,OBJECT_LISTn)
    SQL> -- )
    SQL> --
    SQL> -- LIST OF OBJECTS = (
    SQL> -- (TYPE1, NAME_LIST1).., (TYPEn, NAME_LISTn)
    SQL> -- )
    SQL> --
    SQL> -- LIST OF NAMES = ( NAME1..,NAMEn )
    SQL>
    SQL>
    SQL> create or replace type TObjectList is table of varchar2(50)
    2 /
    Type created.
    SQL>
    SQL> create or replace type TObjType is object(
    2 obj_type varchar2(50),
    3 obj_list TObjectList
    4 );
    5 /
    Type created.
    SQL>
    SQL> create or replace type TObjTypeList is table of TObjType;
    2 /
    Type created.
    SQL>
    SQL> create or replace type TUser is object(
    2 user_name varchar2(50),
    3 objects TObjTypeList
    4 );
    5 /
    Type created.
    SQL>
    SQL> create or replace type TUserList is table of TUser;
    2 /
    Type created.
    SQL>
    SQL> col NESTED_STRUCTURE format a100
    SQL>
    SQL> -- constructing the above user list (have made the start of the USER bold in the output below)
    SQL> select
    2 CAST( COLLECT(
    3 TUser(
    4 username,
    5 CAST( MULTISET(
    6 select
    7 TObjType(
    8 object_type,
    9 CAST( COLLECT(o.object_name) as TObjectList)
    10 )
    11 from all_objects o
    12 where o.owner = u.username
    13 group by
    14 o.object_type
    15 ) as TObjTypeList
    16 )
    17 )
    18 ) as TUserList
    19 ) as NESTED_STRUCTURE
    20 from all_users u
    21 where u.username in ('BILLY','DBSNMP')
    22 /
    NESTED_STRUCTURE(USER_NAME, OBJECTS(OBJ_TYPE, OBJ_LIST))
    TUSERLIST(TUSER('BILLY', TOBJTYPELIST(TOBJTYPE('FUNCTION', TOBJECTLIST('GETEMP', 'GETEMP2', 'TESTRET
    URN', 'WTF', 'ANOOP_REF')), TOBJTYPE('INDEX', TOBJECTLIST('PK_DEPT', 'PK_EMP')), TOBJTYPE('PROCEDURE
    ', TOBJECTLIST('USESEQ1', 'FOOPROC', 'W')), TOBJTYPE('TABLE', TOBJECTLIST('X', 'LOAD_TABLE', 'DEPT',
    'EMP', 'BONUS', 'SALGRADE')), TOBJTYPE('TYPE', TOBJECTLIST('TEMP', 'TEMPLOYEE', 'TX', 'TARRAY2D', '
    TARRAY1D', 'TARRAY3D', 'TOBJECT', 'TOBJTYPE', 'TOBJECTLIST', 'TOBJTYPELIST', 'TUSER', 'TUSERLIST', '
    SYSTPTkQoC5hBR+DgQPsKOl0PFQ==', 'SYSTPTkQoC5hyR+DgQPsKOl0PFQ==', 'SYSTPTkQoC5qzR+DgQPsKOl0PFQ==', 'S
    YSTPTkQoC5raR+DgQPsKOl0PFQ==')))), TUSER('DBSNMP', TOBJTYPELIST(TOBJTYPE('INDEX', TOBJECTLIST('MGMT_
    DB_FILE_GTT_PK', 'MGMT_DB_SIZE_GTT_PK')), TOBJTYPE('PACKAGE', TOBJECTLIST('MGMT_RESPONSE')), TOBJTYP
    E('PACKAGE BODY', TOBJECTLIST('MGMT_RESPONSE')), TOBJTYPE('SEQUENCE', TOBJECTLIST('MGMT_RESPONSE_CAP
    TURE_ID', 'MGMT_RESPONSE_SNAPSHOT_ID')), TOBJTYPE('TABLE', TOBJECTLIST('MGMT_SNAPSHOT', 'MGMT_SNAPSH
    OT_SQL', 'MGMT_BASELINE', 'MGMT_BASELINE_SQL', 'MGMT_CAPTURE', 'MGMT_CAPTURE_SQL', 'MGMT_RESPONSE_CO
    NFIG', 'MGMT_LATEST', 'MGMT_LATEST_SQL', 'MGMT_HISTORY', 'MGMT_HISTORY_SQL', 'MGMT_TEMPT_SQL', 'MGMT
    DBFILE_GTT', 'MGMT_DB_SIZE_GTT')), TOBJTYPE('VIEW', TOBJECTLIST('MGMT_RESPONSE_BASELINE')))))
    SQL>
    PS. To understand how the SQL works, run it from the inside out - i.e. run the innermost select on its own to see the output and then add to it until the full select is reached.

  • Object Modelling Question: How do I create multiple nested table columns in one table

    Hi there,
    I have a XML doc which is as follows:
    <PERSON>
    <ADDRESSLIST>
    <ADDRESS>111, Hamilton Ave </ADDRESS>
    <ADDRESS>222, Cambell Ave </ADDRESS>
    </ADDRESSLIST>
    <PHONELIST>
    <PHONENO>4085551212 </PHONENO>
    <PHONENO>6505551212</PHONENO>
    </PHONELIST>
    </PERSON>
    I need a table that looks as follows:
    Create table person
    (addresslist address_table,
    phonelist phone_table
    I would like to create a table called person with columns addresslist and phonelist. Each defined as object type table of address and table of phones.
    Can anybody please tell me how can I do this.
    I have seen that there can only be one nested table per table. If so, how do we do this.
    Thanks so much
    Pramod

    pelle.k wrote:
    peets wrote:Hehe because it's less typing!
    Good one!
    Also, it's by far the more dynamic method.
    If you want to get pedantic, it's also far less efficient in terms of execution time: each iteration of the loop forks a new process, whereas using a single mkdir command forks only once.  The "best" way is the curly-braces method demonstrated above by chimeric.

  • How to insert reference of object in nested table

    hi , i have a problem with nested table :
    CREATE OR REPLACE TYPE ITEM AS OBJECT
    ITEM_ID NUMBER,
    ITEM_DES VARCHAR2(4000),
    PRODUCT_NO VARCHAR2(15),
    PRODUCT_DES VARCHAR2(4000)
    CREATE TABLE ITEMS OF ITEM
    CONSTRAINT ITEM_PK PRIMARY KEY (ITEM_ID)
    CREATE OR REPLACE TYPE BOM AS OBJECT
    BOM_ID NUMBER,
    ITEM_ID NUMBER,
    BOM_PARENT_ID number
    create or replace type boms as table of ref bom;
    create table bom_table
    bom_ids bom,bom_member boms
    ) nested table bom_member store as bom_childs;
    insert into bom_table (bom(1,1,null),null);
    insert into bom_table (bom(2,1,1),boms(select ref(t) from bom_table t where t.bom_id=1))
    show error.
    how i can insert in nested table reference of object
    thanks

    your table "bom_table" is not an object table or view, and thus you can't create object references to it's rows. you'll need to create an object table or view of "bom" objects, with a corresponding object identifier, and then reference that table/view in your subquery instead.
    Gerard

  • Performance impact using nested tables and object

    Hi,
    Iam using oracle 11g.
    While creating a package, iam using lot of nested tables created based on objects which will be passed between multiple functions in the package..
    Will it have any performance impact since all the data is stored in the memory.
    How can i measure the performance impact when the data grows ?
    Regards,
    Oracle User
    Edited by: user9080289 on Jun 30, 2011 6:07 AM
    Edited by: user9080289 on Jun 30, 2011 6:42 AM

    user9080289 wrote:
    While creating a package, iam using lot of nested tables created based on objects which will be passed between multiple functions in the package.. Not the best of ideas in general, in PL/SQL. This is not client code that can lay sole claim to most of the memory. It is server code and one of many server processes that need to share the available resources. So capitalism is fine on a client, but you need socialism on the server? {noformat} ;-) {noformat}
    Will it have any performance impact since all the data is stored in the memory.Interestingly yes. Usually crunching data in memory is better. In this case it may not be so. The memory used is the most expensive memory Oracle can use - the PGA. Private process memory. This means each process copy running that code, will need lots of memory.
    If you're not passing the data structures by reference, it means even bigger demands on memory as the data structure needs to be copied into the call stack and duplicated.
    The worse case scenario is that such code consumes so much free server memory, and make such huge demands on having that in pysical memory, it trashes memory management as the swap daemons are unable to keep up with the demand of swapping virtual memory pages into and out of memory. Most CPU time is spend by the swap daemons.
    I have seen servers crash due to this. I have seen a single PL/SQL process causing this.
    How can i measure the performance impact when the data grows ?Well, you need to look at the impact of your code on PGA memory. It is not SQL performance or I/O performance that is a factor - just how much private process memory your code needs in order to execute.

  • View of values in nested table attribute of object type

    Hi,
    I have:create or replace type ctx_line is object (
      ctx_name  varchar2(40),
      ctx_value varchar2(1000)
    create or replace type ctx_tab is table of ctx_line;
    create type tp as object (
      id      number,
      ctx     ctx_tab
    create table tt of tp nested table ctx store as ctx_nesttab;
    create or replace view v as
    SELECT VALUE(o).id as id
      FROM tt o;Now I want to create an another view containing fields ctx_name, ctx_value and a key (maybe NESTED_TABLE_ID?) to the parent record in tt table. I must be able to join that view to each other. This is necessary because I will use that views in Forms 4.5 (which do not support nested tables).
    Can someone help me, please?

    I'm not sure what you are looking for exactly but is it something like this?
    SELECT id
         , p.ctx_name
         , p.ctx_value
    FROM   tt
         , TABLE(ctx) pWith the following test data:
    INSERT INTO tt VALUES(1,CTX_TAB(CTX_LINE('A','SOME VALUE1')));
    INSERT INTO tt VALUES(1,CTX_TAB(CTX_LINE('B','SOME VALUE2')));
    INSERT INTO tt VALUES(1,CTX_TAB(CTX_LINE('B','SOME VALUE2')));this is the result:
    SQL> SELECT id
      2       , p.ctx_name
      3       , p.ctx_value
      4  FROM   tt
      5       , TABLE(ctx) p
      6  /
            ID CTX_NAME                                 CTX_VALUE
             1 A                                        SOME VALUE1
             1 B                                        SOME VALUE2
             1 B                                        SOME VALUE2

  • Oracle object, nested table on a subtype

    Hello,
    Is it possible to have a nested table on a subtype? If it is, can someone help me?
    Here is what I need help for:
    I have a supertype WORK, that have:
    multivalued attribute ADDRESS
    a attribute NAME, also the primary key
    The subtype is called EMPLOYEE, that have:
    multivalued attribute SPECIALTY
    a attribute NAME
    a attribute SSN
    So far have I got:
    //* The supertype *//
    create or replace type ADRESS_TP as object(
    ADRESS varchar2(50));
    create or replace type ADRESSTP as table of ADRESS_TP;
    create or replace WORK_TP as object(
    NAME varchar2(30),
    ADRESS ADRESSTP)
    NOT FINAL;
    create table WORK_TBL of WORK_TP(
    Primary key(NAME))
    nested table ADRESS store as NT_ADR(
    (Primary key(nested_table_id, ADRESS))
    organization index compress);
    //* The subtype *//
    create or replace type SPECIALTY_TP as object(
    ADRESS varchar2(50));
    create or replace type SPECIALTYTP as table of SPECIALTY_TP;
    create or replace EMPLOYEE_TP under work_tp(
    NAME varchar2(30),
    SSN number)
    FINAL;
    The multivalued attribute SPECIALTYTP has to be declared in WORK_TBL have I been told, but how can I do that?
    I'm using oracle 9i

    I'm not really sure what your problem is. In future please be specific about what it is you are trying to do and what it is that is not working. If it's an error please give us the error message and number. It's not the behaviour you are expecting please describe what it does. If it's that you simply don't understand please say what you don't understand.
    I go on like this because the code you have posted is somewhat confusing. The Oracle object-oriented implementation is not quite complete so that makes it hard for people who know OO but don't know Oracle. Whereas most of us who know Oracle aren't expert in OO. Also, I think you should be slightly more inventive in your names: there's so many things called ADRESS it's easy to get them tangled up.
    Anyway, here's my guess at what I think your problem is....
    SQL> CREATE OR REPLACE TYPE adress_t AS OBJECT(
      2  line1 VARCHAR2(50)
      3  ,line2 VARCHAR2(50)
      4  ,postcode VARCHAR2(8));
      5  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE adress_nt AS TABLE OF adress_t;
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE work_t AS OBJECT(
      2   name VARCHAR2(30),
      3   adresses adress_nt)
      4  NOT FINAL;
      5  /
    Type created.
    SQL> CREATE TABLE work_tbl OF work_t
      2     NESTED TABLE adresses STORE AS adress_ntab
      3  /
    Table created.
    SQL> CREATE OR REPLACE TYPE specialty_t AS OBJECT(
      2  description VARCHAR2(50));
      3  /
    Type created.
    SQL> CREATE OR REPLACE TYPE specialty_nt AS TABLE OF specialty_t;
      2  /
    Type created.
    SQL>
    SQL> ALTER TYPE work_t ADD ATTRIBUTE specialities specialty_nt CASCADE
      2  /
    Type altered.
    SQL> DESC work_tbl
    Name                                      Null?    Type
    NAME                                               VARCHAR2(30)
    ADRESSES                                           ADRESS_NT
    SPECIALITIES                                       SPECIALTY_NT
    SQL> Cheers, APC

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

  • SQL Loader Constraints with Column Objects and Nested Tables

    I am working on loading a Table that (god forbid) contains columns, column objects, and nested tables (which contains several depth of column objects). My question is does SQL Loader have a hidding undocumented feature where it states how the column objects must be grouped in refereneced to the nested tables within the loader file? I can load the various column objects, and nested tables fine right now, however, I am loading them all in strange and insane order. Can anyone answer this question? Thanks.
    Peter

    I just noticed that my email is wrong. If you can help, plese send email to [email protected]
    thanks.

  • Error when creating table with nested table of object

    Dear all,
    I tried to create a table that contains nested table of an object but got an error:
    create or replace type some_obj is object (
      a number, b blob
      4  /
    Type created.
    create or replace type some_type is table of some_obj;
      2  /
    Type created.
    SQL>
    create table test (obj_id number, temp some_type) nested table temp store as nes_tab;
    Table created.
    SQL> create table test (obj_id number, temp some_type) nested table temp store as nes_tab
    ERROR at line 1:
    ORA-00955: name is already used by an existing objectWhat is causing the error? How can I troubleshoot this?
    best regards,
    Val

    Valerie Debonair wrote:
    never mind, I put "/" at the end of the create statement that makes executing create table twice....Yep. If I'm writing a script, I tend to just stick with "/" for all my statements, including the SQL as well as the DDL, otherwise it can be confusing whether a ";" is needed or not or whether it will try and execute it twice like you found.
    "/" works for all.

  • Object view  with nested table and member functions????????????????

    HI frds:)
    I need some help regarding writeing soem queries..
    I have to use view in retreving data and by useing member functions of object.
    1) i have to create a nested table by useing type object.
    2) i have to create a object wtih member functions inorder to create view of taht nested table,.
    3) by useing this objectt view and by useing methods i have to write soem queries ...
    If any one know or any information regarding this please reply me... as i have searched in net alot but i was unable to figure out..
    Thanks....

    // first createing object
    create type emp_det as object
    (empname varcahr2(20),start_date date,end_date date);
    // creating table of that object
    create table emp_detai_table as table of emp_det;
    // creating nested table
    create table empl (emp_no number,emp_detail emp_detail_table,dep_no number)nested table emp_detail store as s;
    //now i want to create view.. inorder to create view i need to create object. in that object i want to create methods.. these methods should work with date attributes..
    after creating object view i need to select or write some queries by useing member methods..
    This is the tast i have to perform.,. i have no materials ...if u have any link ..forward me..
    i have to do it as soon as possible..
    waiting for your reply...

  • Fill datagridview with Nested Table Object Type ???

    Hello everybody, please you help me resolve my problem?
    I follow this example: *(A Sample Application using Object-Relational features)* http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10799/adobjxmp.htm
    And this tutorial: *(Using Oracle User-Defined Types with .NET and Visual Studio)* http://www.oracle.com/technology/obe/hol08/dotnet/udt/udt_otn.htm
    Now I have 3 Object Table: Stock, Customer and Purchase Order. With the tutorial it's OK to show the data of Stock and Customer Table [there is no nested table in], but I can't do this with table Purchase Order, the tutorial don't show how to work with Nested Table type [Missing or something ?]
    When I try to display the data of table Purchase Order, I get the error:
    typeName='LINEITEMLIST_NTABTYP'' is not specified or is invalid*
    Follow the tutorial, I generate custom class for this UDT and get another error:
    this.STOCK_REF = ((object)(Oracle.DataAccess.Types.OracleUdt.GetValue(con, pUdt, "STOCK_REF")));*
    Argument Exception Unhandle: Object attribute is not mapped to a custom type member.*
    Can You show me how to do this ? Show the data of the Nested Table in Visual Studio, do I have something wrong ??? Thanks and Best Regards.

    I think you need to go through the tutorial more carefully. I think you are missing steps.
    You are using a REF. Are you creating an object table for the objects to be stored in? Are you dereferencing the REF? This is covered by the Oracle by Example tutorial.
    http://www.oracle.com/technology/obe/hol08/dotnet/udt/udt_otn.htm#t11
    When you receive the nested table, it will be inside a .NET class. You can create this class by using the Create Custom Class menu item on the nested table type in server explorer.
    This class will contain a ToString method and a ToXML method.
    The question is, where are you attempting to display the data from this nested table? In a grid?
    Does it make sense to display a nested table inside one cell of a grid? No. You would need to construct a special UI that will show the
    nested table. Maybe the user clicks on the cell on the grid, which opens a new grid that displays the data. Or maybe there is a second grid on the form that always shows the nested table for the row that the first grid currently has selected.
    I realize I am not providing you the code... but it sounds like you need to design a more sohisticated UI than what the tutorial is using -- one that can handle displaying one additional table per row.

  • Inserting into a doubly nested table through an object view

    Can anyone give me an example of an INSTEAD OF trigger that will mediate an INSERT into a doubly nested table of an Object View? Is there syntax that will allow it?

    Here's some code to demonstrate. Note that relational tables, not an object table, are used to store object instances:
    create or replace type TInnerNestedTable
    is table of varchar2(20)
    create or replace type TOuterNestedTable
    is table of TInnerNestedTable
    create or replace type TMyObject
    is object
         id     varchar2(20)
    ,     tab     TOuterNestedTable
    create
    table     T_MY_OBJECT
         id          varchar2(20)     not null
    ,     primary key (id)
    create
    table     T_MY_OBJECT_TAB_OUTER
         id          varchar2(20)     not null
    ,     outerIndex     integer          not null
    ,     primary key (id, outerIndex)
    ,     foreign key (id) references T_MY_OBJECT on delete cascade
    create
    table     T_MY_OBJECT_TAB_INNER
         id          varchar2(20)     not null
    ,     outerIndex     integer          not null
    ,     innerIndex     integer          not null
    ,     innerValue     varchar2(20)
    ,     primary key (id, outerIndex, innerIndex)
    ,     foreign key (id, outerIndex) references T_MY_OBJECT_TAB_OUTER on delete cascade
    create or replace view V_MY_OBJECT
    of TMyObject
    with object identifier (id)
    as
    select     t.id
    ,     cast(multiset(
              select     cast(multiset(
                        select     i.innerValue
                        from     T_MY_OBJECT_TAB_INNER i
                        where     i.id = o.id
                        and     i.outerIndex = o.outerIndex
                   ) as TInnerNestedTable)
              from     T_MY_OBJECT_TAB_OUTER o
              where     o.id = t.id
         ) as TOuterNestedTable)
    from     T_MY_OBJECT t
    create or replace trigger TR_II_V_MY_OBJECT
    instead of insert on V_MY_OBJECT
    for each row
    begin
         insert
         into     T_MY_OBJECT
              id
         values     (
              :new.id
         insert
         into     T_MY_OBJECT_TAB_OUTER
              id
         ,     outerIndex
         select     :new.id
         ,     rownum
         from     table(:new.tab) o;
         insert
         into     T_MY_OBJECT_TAB_INNER
              id
         ,     outerIndex
         ,     innerIndex
         ,     innerValue
         select     :new.id
         ,     o.outerIndex
         ,     rownum
         ,     value(i)
         from     (
              select     :new.id
              ,     rownum outerIndex
              ,     value(o) innerTab
              from     table(:new.tab) o
              ) o
         ,     table(o.innerTab) i;
    end;
    insert
    into     V_MY_OBJECT
    values     (
         new TMyObject(
              'A'
         ,     TOuterNestedTable(
                   TInnerNestedTable('A','B','C')
              ,     TInnerNestedTable('AA')
              ,     TInnerNestedTable('AB')
    insert
    into     V_MY_OBJECT
    values     (
         new TMyObject(
              'B'
         ,     TOuterNestedTable(
                   TInnerNestedTable('X','Y','Z')
              ,     TInnerNestedTable('Hello', 'World!')
    /Selecting from the view shows the results:
    select     value(o)
    from     V_MY_OBJECT o
    VALUE(O)(ID, TAB)
    TMYOBJECT('A', TOUTERNESTEDTABLE(TINNERNESTEDTABLE('A', 'B', 'C'), TINNERNESTEDTABLE('AA'), TINNERNESTEDTABLE('AB')))
    TMYOBJECT('B', TOUTERNESTEDTABLE(TINNERNESTEDTABLE('X', 'Y', 'Z'), TINNERNESTEDTABLE('Hello', 'World!')))
    2 rows selected.Hope that helps...
    Gerard

Maybe you are looking for

  • Getting Error While Running Search Page

    Hi All, We were building a new custom Application using OA Framework. We had starting page as search page. Suddenly while running that seach page from JDeveloper i am getting following error oracle.apps.fnd.framework.OAException: java.lang.NullPointe

  • DAO and Domain Object

    hi, Normally when i want to persist a domain object like Customer object to a database, my statements will be below, // code from my facade Customer cust = new Customer(); cust.setFirstName("myname"); cust.setLastName("mylastname"); // set another at

  • Deafult batch for component in process order

    Hi Experts , in one of the scenario the client requirement is the batch number for eg- "a" , should be automatically populated in the batch number column of the component in process order while saving or while release. this should be done only for co

  • Mail settings are not saved any more

    Hi, after my mailbox structure has crashed, I tried to reset Mail as explained in this answer: https://discussions.apple.com/message/22302114#22302114 After restarting Mail all settings were deleted (as expected) and I set up my accounts and settings

  • Apple mail and drafts

    Using Mail 8.1 Suppose I make several different drafts and have multiples of them, say 2 of draft #1 and 5 of draft #2. The overall total (7) is shown when the folder is closed and if I open the folder I see the 2 different drafts. Fine except how do