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

Similar Messages

  • Require help on Array of Nested tables and Oracle Object type

    Hi All,
    I have a scenario where I have some millions of records received from a flat file and the record is stored in Table as below:
    Tablename: FILE_RECORD
    Rows:
    FILE_REG_ID = 1
    RECORD_NBR = 1     
    PROCESSED_IND = U
    RECORD= 00120130326006A
    FILE_REG_ID = 1
    RECORD_NBR = 2     
    PROCESSED_IND = U
    RECORD= 00120130326003
    1) I have to read these records at once and
    a) Split the RECORD column to get various other data Eg: Fld1=001, Fld2=20130326, Fld3 = 003
    b) send as an Array to Java.
    2) Java will format this into XML and sent to other application.
    3) The other application returns a response as Successful or Failure to Java in XML
    4) Java will send RECORD_NBR and the corresponding response as Success or Failure back to PLSQL
    5) PLSQL should match the RECORD_NBR and update the PROCESSED_IND = P.
    I 'm able to achieve this using SQL Table type by creating a TYPE for Each of the fields (Flds) however the problem is Java cannot Access the parameters as the TYPE are of COLUMN Types
    Eg: For RECORD_NBR
    SUBTYPE t_record_nbr IS FILE_RECORD.T010_RECORD_NBR%TYPE;
    Can you please let me know how I can achieve this to support Java, I know one way that is by creating an OBJECT TYPE and a TABLE of the OBJECT TYPE.
    Eg: T_FILE_RECORD_REC IS OBJECT
    FILE_REG_ID number(8), RECORD_NBR number (10), PROCESSED_IND varchar2(1), RECORD varchar(20)
    Create type T_FILE_RECORD_TAB IS TABLE OF T_FILE_RECORD_REC
    However I'm facing a problem to populate an Array of records, I know I'm missing something important. Hence please help.
    It would be helpful to provide some guidelines and suggestions or Pseudo or a Code to achieve this. Rest all I can take up further.
    Thanks in advance,

    I know once way that is creating a OBJECT TYPE and a TABLE of OBJECT TYPE, howeve I feel I'm missing something to achieve this.You're right, you need SQL object types created at the database level. Java doesn't know about locally defined PL/SQL types
    However you can do without all this by creating the XML directly in PL/SQL (steps 1+2) and passing the document to Java as XMLType or CLOB.
    Are you processing the records one at a time?

  • How do I update a Nested Table of inherited Object Types?

    Does anyone know why the following line (commented out) doesn't work and what I can do? Is there some way to cast the column I am trying to update? I think I am going crazy....
    create or replace type person_ot as object (name varchar2(10)) not final;
    create or replace type student_ot under person_ot (s_num number) not final;
    create type person_tt as table of person_ot;
    declare
    lv_person_list person_tt;
    lv_sql varchar2(1000);
    ref_cur sys_refcursor;
    begin
    lv_sql:= 'select new student_ot(''fred'', 100) from dual
    union all
    select new student_ot(''sally'', 200) from dual';
    open ref_cur for lv_sql;
    fetch ref_cur bulk collect into lv_person_list;
    close ref_cur;
    dbms_output.put_line(lv_person_list.count);
    for i in lv_person_list.first..lv_person_list.last loop
    lv_person_list(i).name := initcap(lv_person_list(i).name ); -- This works!
    lv_person_list(i).s_num := 9999;  Why doesn't this line work and how can I update the column s_num ??? :-(
    end loop;
    end;
    /

    Hi Tubby - You are right...It would make sense to create the Type as type of student_ot. Only problem is I am trying to keep it generic. I will include full listing to show what I am doing...
    create or replace type person_ot as object (name varchar2(10)) not final;
    create or replace type student_ot under person_ot (s_num number) not final;
    create type person_tt as table of person_ot;
    create table persons of person_ot;
    declare
    lv_person_list person_tt;
    lv_sql varchar2(1000);
    ref_cur sys_refcursor;
    begin
    lv_sql:= 'select new student_ot(''fred'', 100) from dual
    union all
    select new student_ot(''sally'', 200) from dual';
    open ref_cur for lv_sql;
    fetch ref_cur bulk collect into lv_person_list;
    close ref_cur;
    for i in lv_person_list.first..lv_person_list.last loop
    lv_person_list(i).name := initcap(lv_person_list(i).name );
    lv_person_list(i).s_num := 9999;*                             Why doesn't this line work?? :-(
    end loop;
    forall i in lv_person_list.first..lv_person_list.last
    insert into persons values lv_person_list(i);
    end;
    /

  • 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

  • Trigger how to get new and old value for nested table column?

    Hi,
    I have created a nested table based on the following details:
    CREATE TYPE typ_item AS OBJECT --create object
    (prodid NUMBER(5),
    price NUMBER(7,2) )
    CREATE TYPE typ_item_nst -- define nested table type
    AS TABLE OF typ_item
    CREATE TABLE pOrder ( -- create database table
    ordid NUMBER(5),
    supplier NUMBER(5),
    requester NUMBER(4),
    ordered DATE,
    items typ_item_nst)
    NESTED TABLE items STORE AS item_stor_tab
    INSERT INTO pOrder
    VALUES (800, 80, 8000, sysdate,
    typ_item_nst (typ_item (88, 888)));
    Now I would like to create a trigger on table pOrder for after insert or update or delete
    and I would like to track the new and old value for the columns inside nested table.
    Can anybody direct me how to do it?
    I would like to know the sytax for it like:
    declare
    x number;
    begin
    x := :new.nestedtablecolumn;--how to get the new and old value from nested table columns
    end;
    Hope my question is clear.
    Thanks,
    Lavan

    Hi,
    Try like this:
    CREATE OR REPLACE TRIGGER PORDER_I
    BEFORE INSERT
    ON PORDER
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    DECLARE
      items_new typ_item_nst;
      ordid_NEW NUMBER;
    BEGIN
    FOR i IN :new.items.FIRST .. :new.items.LAST LOOP -- For first to last element
      DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').prodid: ' || :new.items(I).prodid );
      DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').price:  ' || :new.items(I).price );
    END LOOP;
    END;Regards,
    Peter

  • How to assign Values to nested table and pass as parameter to procedure?

    How to assign Values to nested table and pass as parameter to procedure?
    Below is the Object and its type
    create or replace type test_object1 as object
    val1 varchar2(50),
    val2 varchar2(50),
         val3 varchar2(50)
    create or replace type test_type1 is table of test_object1;
    create or replace type test_object2 as object
    val1 varchar2(50),
    val2 varchar2(50),
         val3 varchar2(50)
    create or replace type test_type2 is table of test_object2;
    GRANT ALL ON test_object1 TO PUBLIC;
    GRANT ALL ON test_type1 TO PUBLIC;
    GRANT ALL ON test_object2 TO PUBLIC;
    GRANT ALL ON test_type2 TO PUBLIC;
    here is the table made of object type:
    create table test_object_tpe
    sl_num NUMBER,
    description VARCHAR2(100),
    main_val1 test_type1,
    main_val2 test_type2
    NESTED TABLE main_val1 STORE AS tot1
    NESTED TABLE main_val2 STORE AS tot2;
    here is the procedure which inserts values into nested table:
    PROCEDURE INSERT_TEST_DATA(sl_num IN NUMBER,
    description IN VARCHAR2,
    p_main_val1 IN test_type1,
    p_main_val2 IN test_type2
    IS
    BEGIN
    FOR rec in p_main_val1.first..p_main_val1.last
    LOOP
    INSERT INTO xxdl.test_object_tpe
    sl_num,
    description,
    main_val1,
    main_val2
    VALUES
    sl_num
    ,description
    ,test_type1 (test_object1(
    p_main_val1(rec).val1,
                                       p_main_val1(rec).val2,
    p_main_val1(rec).val3
    ,test_type2 (test_object2( p_main_val2(rec).val1,
                        p_main_val2(rec).val2,
                        p_main_val2(rec).val3
    END LOOP;
    commit;
    END INSERT_TEST_DATA;
    here is the anonymoys block which assigns values to the object type and pass values into the procedure:
    set serveroutput on;
    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1(1).val1 := 'testx1';
    inval1(1).val2 := 'testx2';
    inval1(1).val3 := 'testx3';
    inval2(1).val1 := 'testy1';
    inval2(1).val2 := 'testy2';
    inval2(1).val3 := 'testy3';
    CSI_PKG.INSERT_TEST_DATA(sl_num => p_sl_num,
    description => p_description,
    p_main_val1 => inval1,
    p_main_val2 => inval2
    end;
    Can anybody correct me.
    Thanks,
    Lavan

    Thanks for posting the DDL and sample code but whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
    >
    How to assign Values to nested table and pass as parameter to procedure?
    >
    Well you are doing almost everything wrong that could be done wrong.
    Here is code that works to insert data into your table (the procedure isn't even needed).
    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1.extend();
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');
    inval2.extend();
    inval2(1) := test_object2('testy1', 'testy2', 'testy3');
    INSERT INTO test_object_tpe
    sl_num,
    description,
    main_val1,
    main_val2
    VALUES
    (p_sl_num, p_description, inval1, inval2);
    commit;
    end;
    /See Example 5-15 Referencing a Nested Table Element in Chap 5 Using PL/SQL Collections and Records in the PL/SQL doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/collections.htm#CJABEBEA
    1. You don't even need the procedure since all it does is a simple INSERT into the table which you can do directly (see my code above)
    inval1(1).val1 := 'testx1';There is no element one (1) of 'inval1' since you haven't created any elements yet. You need to EXTEND the collection to add an element
    inval1.extend();And then there is an empty element but 'inval1' is a container for objects of type 'test_object1' not for scalars like 'val1', 'val2', and 'val3'.
    So you can't do
    inval1(1).val1 := 'testx1';You have to create an instance of 'test_object1'
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');And so on for the other collection
    You don't need the procedure (as my sample code shows) but once you populate the variables properly it will work.

  • TYPE OR TABLE DEPENDENCY OF OBJECT TYPE (ORA-2303)

    제품 : SQL*PLUS
    작성날짜 : 2004-05-20
    ==================================================
    TYPE OR TABLE DEPENDENCY OF OBJECT TYPE (ORA-2303)
    ==================================================
    PURPOSE
    Type이나 table의 dependency가 있는 type을 drop하거나 replace하고자
    하면 ORA-02303 error가 난다. 이 error의 원인을 알아보도록 한다.
    Explanation
    Object의 attribute나 method를 수정하기 위해서는 object type을 drop하고 재생성
    해야 한다. Type이나 table의 dependency가 있는 type을 drop하거나 replace하고자
    하면 ORA-02303 error가 난다. Object type은 type (nested table 또는 VARRAY)
    또는 object table로써 구체적으로 표현된다. 만약 data의 보존이 필요하다면
    temporary table에 manual하게 옮겨놓아야 한다.
    SQL Reference guide에 의하면 DROP TYPE FORCE 옵션은 recommend하지 않는다.
    왜냐하면 이 옵션을 쓰게 되면 복구가 불가능하고 dependency가 있던 table들은
    access하지 못하는 결과를 초래한다.
    Example
    아래의 query 1, 2, 3은 dependency을 확인하는 query문이다.
    1. Find nested tables
    select owner, parent_table_name, parent_table_column
    from dba_nested_tables
    where (table_type_owner, table_type_name) in
    (select owner, type_name
    from dba_coll_types
    where elem_type_owner = '<typeOwner>'
    and elem_type_name = '<typeName>');
    2. Find VARRAYs
    select owner, parent_table_name, parent_table_column
    from dba_varrays
    where (type_owner, type_name) in
    (select owner, type_name
    from dba_coll_types
    where elem_type_owner = '<typeOwner>'
    and elem_type_name = '<typeName');
    3. Find object tables
    select owner, table_name
    from dba_object_tables
    where table_type_owner = '<typeOwner>'
    and table_type = '<typeName>'
    and nested = 'NO';
    Example ) Logon as Scott
    /* Create an user defined object type */
    SQL> create type object_type as object (
    col1 number,
    col2 varchar2(20))
    Type created.
    /* Create nested table type */
    SQL> create type object_ntable as table of object_type
    Type created.
    /* Create varray type*/
    SQL> create type object_varray as varray(5) of object_type
    Type created.
    /* Create parent table with nested table and varray */
    SQL> create table master (
    col1 number primary key,
    col2_list object_ntable,
    col3_list object_varray)
    nested table col2_list store as master_col2
    Table created.
    /* Create object table */
    SQL> create table object_table of object_type (col1 primary key)
    object id primary key;
    Table created.
    ORA-2303 results if attempt to drop type with dependencies
    SQL> drop type object_type;
    drop type object_type
    ERROR at line 1:
    ORA-02303: cannot drop or replace a type with type or table dependents
    위의 queery 1,2,3을 이용하여 object type dependency을 확인한다.
    -- Find nested tables utilizing object type
    SQL> select owner, parent_table_name, parent_table_column
    from dba_nested_tables
    where (table_type_owner, table_type_name) in
    (select owner, type_name
    from dba_coll_types
    where elem_type_owner = 'SCOTT'
    and elem_type_name = 'OBJECT_TYPE');
    OWNER PARENT_TABLE_NAME PARENT_TABLE_COLUMN
    SCOTT MASTER COL2_LIST
    -- Find VARRAYs utilizing object type
    SQL> select owner, parent_table_name, parent_table_column
    from dba_varrays
    where (type_owner, type_name) in
    (select owner, type_name
    from dba_coll_types
    where elem_type_owner = 'SCOTT'
    and elem_type_name = 'OBJECT_TYPE');
    OWNER PARENT_TABLE_NAME PARENT_TABLE_COLUMN
    SCOTT MASTER COL3_LIST
    -- Find object tables
    SQL> select owner, table_name
    from dba_object_tables
    where table_type_owner = 'SCOTT'
    and table_type = 'OBJECT_TYPE'
    and nested = 'NO';
    OWNER TABLE_NAME
    SCOTT OBJECT_TABLE
    참고)
    bulletin : 11576 처럼 utility을 이용하는 방법이 있다.
    우리는 여기서 주의하여야 할 것은 script $ORACLE_HOME/rdbms/admin/utldtree.sql
    을 내가 보고자 하는 user에서 돌려야 한다는 것이다.
    $sqlplus scott/tiger
    SQL> @$ORACLE_HOME/rdbms/admin/utldtree.sql
    SQL> exec deptree_fill('TYPE','SCOTT','OBJECT_TYPE');
    PL/SQL procedure successfully completed.
    SQL> select * from ideptree;
    DEPENDENCIES
    TYPE SCOTT.OBJECT_TYPE
    TYPE SCOTT.OBJECT_NTABLE
    TABLE SCOTT.MASTER
    TYPE SCOTT.OBJECT_VARRAY
    TABLE SCOTT.MASTER
    TABLE SCOTT.MASTER_COL2
    TABLE SCOTT.OBJECT_TABLE
    Reference Documents
    Korean bulletin : 11576
    <Note:69661.1>

    Hi Carsten,
    Thanks for the sharp hint. It works.
    However, when I create a table using the schema, it gives me this error:
    varray DOC."LISTOFASSIGNEDNUMBER"."ASSIGNEDNUMBER"
    ERROR at line 14:
    ORA-02337: not an object type column
    Here is the script:
    CREATE TABLE CUSTOMMANIFEST (
    ID NUMBER PRIMARY KEY,
    DOC sys.XMLTYPE
    xmltype column doc
    XMLSCHEMA "http://www.abc.com/cm.xsd"
    element "CustomManifest"
    varray DOC."LISTOFMANIFESTPORTINFO"."MANIFESTPORTINFO"
    store as table MANIFESTPORTINFO_TABLE
    (primary key (NESTED_TABLE_ID, ARRAY_INDEX))
    organization index overflow
    varray DOC."LISTOFASSIGNEDNUMBER"."ASSIGNEDNUMBER"
    store as table ASSIGNEDNUMBER_TABLE
    (primary key (NESTED_TABLE_ID, ARRAY_INDEX))
    organization index overflow
    LISTOFASSIGNEDNUMBER itself is complexType and not sure where is the error....
    You may note there are more than two hierachy/levels...
    Thanks.

  • Join table with an object type

    Hi,
    I would like ot know how to join a table with another table having an object type as a column value.
    For ex:
    Create type add_obj as object (st varchar2(10), city varchar2(10), zip varchar2(10));
    Table A
    Cust_id number
    cust_address add_obj
    Table B
    Cust_id number
    order_id number
    I want to select the complete address for each order.
    Is this the correct way to do this select:
    Select o.order_id, c.customer_id, c.cust_address.st, c.cust_address.city, c.cust_address.zip
    from table A c, table B o;
    Any leads is appreciated. Thanks in advance.

    >
    unfortunately with a crashed Oracle db I could try nothing.... Forums are for getting help and offering help in times of need.
    Will take your advice some other time. Now need help on how to select the address city, st and zip along with the order_id.
    >
    Ah - I understand - you mean before your class is over.
    Unfortunately with a crashed Oracle db you will not know if our advice is correct or not since you won't be able to test it.
    So I will offer advice some other time. Now need to get some fresh air and a hot cup of coffee.
    Let us know when you DB is back up and you have run your tests. Then if you still have any questions other forum members may decide to help you. Well - if their database is up and running that is.

  • Batch Design Capture of tables that include Object Types

    When I attempt to use the Batch Design Capture facility to capture a table that includes an Object Type the facility dies without completing.
    I am using Designer 9i / Oracle Design Editor v9.0.2.80.4.
    The Batch Design Capture facility reports the following and then exits:
    Repository connected successfully
    Server Generator 9.0.2.80.4, Wed Jun 09 17:24:33 2004
    Copyright (c) Oracle Corporation 1995, 2002. All rights reserved.
    CDS-15334 Warning: The Oracle Object Type MESSAGEHEADER_TYPE already exists in the Repository. NOMERGE_AND_SAC Rule selected
    => the captured property values will not replace the existing property values in the repository but the Rules for the Secondary Elements (SACs) will apply for their own update
    CDS-11305 Warning: Column 'E2B.MESSAGEHEADER' property DEFAULT VALUE exceeds maximum length (60) - Truncated
    The table that I am trying to capture looks like this:
    E2B
    E2B_ID NOT NULL NUMBER
    MESSAGEHEADER MESSAGEHEADER_TYPE
    DATE_TRANSMITTED DATE
    DATE_RECEIVED DATE
    DATE_ACKNOWLEDGED DATE
    ... other columns ...
    MESSAGE CLOB
    and MESSAGEHEADER_TYPE looks like this:
    MESSAGEHEADER_TYPE
    MESSAGETYPE VARCHAR2(16)
    MESSAGEFORMATVERSION VARCHAR2(3)
    MESSAGEFORMATRELEASE VARCHAR2(3)
    MESSAGENUMB VARCHAR2(100)
    MESSAGESENDERIDENTIFIER VARCHAR2(60)
    MESSAGERECEIVERIDENTIFIER VARCHAR2(60)
    MESSAGEDATEFORMAT NUMBER(3)
    MESSAGEDATE NUMBER(14)
    Is is possible to use Designer to capture tables that include object types?

    hi,
    while running the package, use the activity "Maintain Table Reduction" in phase System Analysis to include / exclude / reduce the table from transfer.
    Srila.

  • UserDefined Type Question - Nested Table Attribute

    I have a question about some types I'm trying to create and whether or not it's even possible .....
    Here's the background ...
    I have the following type i created :
    create type asset_stat (
    stat_current varchar2(50),
    stat_change_date date,
    stat_change_user varchar2(30)
    All this type does is simply put a user and date/time stamp when constructed. I want to track status changes for historical tracking.
    Then I want to create a nested table type of the above type as follows:
    create type asset_stat_nt as table of asset_stat
    Then, I have another type i've created which will have the nested table type created above as an attribute.
    create type asset (
    asset_name varchar2(30),
    asset_type varchar2(3),
    asset_stat asset_stat_nt
    Now, the constructor for this asset type is defined like this: ( this is where i get lost)
    constructor function asset (
    asset_nm IN varchar2,
    asset_type_cd in varchar2,
    asset_stat_cd in varchar2 ) return self as result is
    begin
    self.asset_nm := asset_nm
    self.asset_type := asset_type_cd ;
    self.asset_stat := asset_stat_nt(asset_stat_cd);
    return;
    end;
    I just created a table of asset type and tried to do an insert and I'm getting an error related to the line where the nested type is being assigned. Is this possible? If so is my syntax completely off? I'm not quite sure how to set values for the nested type because i want to keep all records of change. Any help would be greatly appreciated.
    thanks

    the block of code shows that asset_stat_nt is the type assigned to asset_stat inside the type asset as shown below
    create type asset (
    asset_name varchar2(30),
    asset_type varchar2(3),
    asset_stat asset_stat_nt
    I guess for the following block of code, the line with the arrows should be given like shown below in bold letters
    constructor function asset (
    asset_nm IN varchar2,
    asset_type_cd in varchar2,
    asset_stat_cd in varchar2 ) return self as result is
    begin
    self.asset_nm := asset_nm
    self.asset_type := asset_type_cd ;
    self.asset_stat := asset_stat_nt(asset_stat_cd);return;
    end;
    [b][b]self.asset_stat := asset(asset_stat_nt(asset_stat_cd));
    I am not pretty sure.......try it anyway.....if it works....good to you

  • Type attribute with Object type or Nested table?

    I have been creating lot many threads around the same problem, however i thought i knew but realized I do not know or else do not know how to..
    I have created object type with an attribute READINGVALUE NUMBER(21,6)...How can i use type attribute on this object while declaring variable.....can we use type attribute on NESTED TABLES, similar to the db tables?
    example
    CREATE TYPE READING AS OBJECT(READINGVALUE NUMBER(21,6));
    CREATE TABLE INTERVALREADINGS OF TYPE READING;

    meghavee wrote:
    Thanks Solomon, however this approach does not preserve precision/scale of number data type.....What you can do is create placeholder tables:
    SQL> create table reading_type_placeholder of reading
      2  /
    Table created.
    SQL> desc reading_type_placeholder
    Name                                      Null?    Type
    READINGVALUE                                       NUMBER(21,6)
    SQL> declare
      2      v_var reading_type_placeholder.readingvalue%type;
      3  begin
      4      v_var := 123456789012345;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL> declare
      2      v_var reading_type_placeholder.readingvalue%type;
      3  begin
      4      v_var := 1234567890123456;
      5  end;
      6  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 4
    SQL>And if you modify type attribute:
    SQL> alter type reading modify attribute readingvalue number(26,6) cascade;
    Type altered.
    SQL> desc reading_type_placeholder
    Name                                      Null?    Type
    READINGVALUE                                       NUMBER(26,6)
    SQL>SY.

  • Null value in Nested table of nested table for xml guru Steve Muench

    The procedure I am using takes xml document with nested levels and insert into single table using DBMS_XMLSave.insertXML.
    I am able to insert into table without any error message but when I am selecting row from table, it is showing null values in all the column of nested table's inner nested table.
    When I am removing nested table's nested table by replacing with object type, it is showing data of object type for the first occurance and ignoring the rest nested occurance.
    Help is greatly appreciated.
    Below is the sql I used to create objects and table:-
    Create or Replace Type addressType as Object
    Line_one     varchar2(40),
    Line_two     varchar2(40),
    City          Varchar2(30),
    State          Varchar2(2),
    zip          Varchar2(10)
    Create or Replace Type ce_reqType as Object
    Status               varchar2(25),
    Status_date          Date,
    type_code          Varchar2(25),
    review_begin_date     Date,
    assigned_review_date     date
    Create or Replace type ce_reqListType
    as table of ce_reqType;
    Create or Replace Type LicenseType as Object
    type_code          Varchar2(10),
    license_number          Varchar2(16),
    ce_requirements      ce_reqListType
    Create or Replace type LicenseListType
    as table of LicenseType;
    Create table IndividualType
    individual_id          Number(9),
    social_security_number Varchar2(9),
    Last_name          varchar2(40),
    First_name          Varchar2(40),
    Middle_name          Varchar2(40),
    Birth_date          Date,
    address          addressType,
    Licenses          LicenseListType
    nested table licenses store as licensestab
    (nested table ce_requirements store as lic_ce_reqtab);

    Maddy wrote:
    dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why)Because instead of adding an element to bookset collectionto are assigning (ergo replacing) it a collection containing last fetched book. Use:
    declare
        bookset book_table;
        ln_cnt pls_integer;
    begin
        bookset := book_table(book_obj('madhu','kongara','sudhan'));
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1
        bookset := book_table(); --> Assigning back to NULL.
        dbms_output.put_line('The count is '||bookset.count); --> I can see count as 0
        for rec in (select * from book) loop --> Now Looping two times.
          dbms_output.put_line(' name > '||rec.name);
          bookset.extend;
          bookset(bookset.count) := book_obj(rec.name, rec.author, rec.abstract);
        end loop;
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why)
    end;
    The count is 1
    The count is 0
    name > Harry Potter
    name > Ramayana
    The count is 2
    PL/SQL procedure successfully completed.
    SQL> Or better use bulk collect:
    declare
        bookset book_table;
        ln_cnt pls_integer;
    begin
        bookset := book_table(book_obj('madhu','kongara','sudhan'));
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1
        bookset := book_table(); --> Assigning back to NULL.
        dbms_output.put_line('The count is '||bookset.count); --> I can see count as 0
        select  book_obj(name,author,abstract)
          bulk collect
          into  bookset
          from  book;
        for i in 1..bookset.count loop --> Now Looping two times.
          dbms_output.put_line(' name > '||bookset(i).name);
        end loop;
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why)
    end;
    The count is 1
    The count is 0
    name > Harry Potter
    name > Ramayana
    The count is 2
    PL/SQL procedure successfully completed.
    SQL> SY.

  • How do I use the value of a table attribute outside the table?

    I have two tables that are master detail. But it might not be so obvious to the user before he knows how the page works that they are master detail. The tables are in separate showDetailItems in a panelAccordion and what I was thinking of was to show the value of one coloum in the selected row in the master in the text in the showdetail item that contains the detail table. But I can´t find the right expression to put into the accordion. How should the expression look like to get the value of an attribute in a table for use outside the table?

    Thanks for the suggestion but it doesn´t work. The first problem is that the page turns blank when I use that expression for the text in the showDetailItem and the second problem is that I don´t seem to be able to use the master table as a partial trigger. When I click edit in the partial trigger property I can´t shuttle the master table over to be a partial trigger to the showDetailItem even if the table has an id.
    Edited by: Atlantic Viking on Apr 2, 2009 6:24 AM
    Well I figured out how to come half way. I did the following things:
    1) Created an attribute value binding to the attribute I wanted to be shown in the showDetailItem
    2) Set the text property in the showDetailItem to this attribute value like this #{binding.attributeValue}
    To solve the problem I had with the partial triggers I continued like this
    3) Gave other components on the path from the showDetailItem to the master table id´s
    4) Clicked edit on the partial trigger property on the showDetailItem and was now able to shuttle the master table over to be a partial trigger.
    But I now got an other problem which looks like a bug. At first when I enter the page it looks fine but when I change focus in the master table to another row part of the showDetailItem containing the detail table disapears. The detail table still remains and works as it should but the part containing the text I tried to set above disapears and the text in the showDetailItem containing the master gets replaced by the text that was supposed to be in the showDetailItem containing the detail table. Any suggestions how to correct this are very welcome.
    Edited by: Atlantic Viking on Apr 2, 2009 6:59 AM

  • Nested tables of user defined types

    Hello all,
    I have philosophical question I am hoping someone can answer for me, "To TYPE, or not to TYPE; that is the question."
    I have created several layers of nested tables in the form:
    CREATE TYPE xyz AS OBJECT();
    CREATE TYPE table_xyz AS TABLE OF xyz;
    CREATE TYPE abc AS OBJECT(
    nested_table1 table_xyz;
    and so on until I end up creating a main table with all these sub tables nested into it.
    But from what I understand oracle stores all of the information in a column of type NESTED TABLE into a single table, rather than one table per row. This means that if I declare a primary key in the nested table it will be against all values in the outer column, not just limited to the values in an individual row of the outer table. Plus it will not let me create foreign keys with in a nested table.
    So why should I use the above construct instead of simply creating separate tables, and use primary and foreign keys to relate them and joins to query?
    I can see the use for types in small cases (addresses, person, etc..) but I do not see the advantage of nested tables. Could someone shed some light on the subject for me?
    Thanks,
    Thomas

    I'll state an opinion, for what it's worth. First, if you are going in the direction of types and nested tables or other collections, you are buying into Oracle's object-relational approach. This has pros and cons as far as design considerations, complexity, and performance that is too involved to get into here. If you just need master/detail table relationships, stick with traditional design techniques. Nested tables can make DML code complex and many tools can't deal with them so you end up having to unnest(flatten) the collections. I'd especially stay away from them if you require multiple nested tables or nested tables within nested tables.

  • How to represent Nested table as variable/Object in OCI

    Hi All,
    I'm new to OCI.
    I've following nested table in my database.
    Nested table:
    create type type1 as object (name varchar2(20));
    create type type2 as table of type1;
    create table table1 (col1 varchar2(20), col2 type2) nested table col2 store as table2;
    Can anyone help me to present col2 as C structure/typedef so as to use it with OCIDefineObject?

    You can have a look at Chapter 11 of the OCI Programmer's Guide. Look at the section Collections in it. You can represent the nested table as OCITable *. Further, you can generate structure representation of your object type by using OTT. Please let us know if this answers your question. In case you are not able to proceed please let us know.
    Thanks,
    Sumit

Maybe you are looking for

  • How to deploy session bean.

    I want to deploy Analyzer.jar on weblogic server,but there is an error information: [J2EE:160043]Missing deployment descriptor "META-INF/ejb-jar.xml" at "D:\bea\user_projects\domains\test\applications\ejb\Analyzer.jar",in fact there is ejb-jar.xml in

  • PL/SQL does not work in Oracle 8i Personal Edition

    I just installed Oracle 8i Personal Edition for Win 98. Everything works perfectly, except the PL/SQL. Then I tried to install Oracle 8i EM, but I always get the listener or adapter error. Even when I tried to start the listener from lsnrctl prompt,

  • WebLogic 11g (JDeveloper11g) Deployment Configuration

    Hello, I developed a Dashboard application using Fusion technology within JDeveloper 11g and Oracle Database Express 10g for not-for profit organization that will track all their global IT Assets. The application look great. I also completed configur

  • Adding support for trinindad

    How to add jsf trinidad or other jsf components to design palette

  • Nano 6G does not wake up from the sleep timer in the same audiobook/track

    My Nano 5G sleep timer will shutdown at the specified time and when I wake it, the Nano will be at the same track and position of my audiobook. However, my Nano 6G will wake up in a random song as if it shuffled after the shutdown. I test by setting