各位大哥大姐,高手们帮帮小弟把,在表1和表2中分别插入2行数据,请知道的大侠把代码写出来把,谢谢了!!
--表1:
Create or replace type Event_Type as object
(EventId varchar2(250),
 Description varchar2 (250),
 EventDate date,
 Location varchar2(100));Create or replace type EventNestedtable as table of Event_Type;--表2:
Create table CateringCustomer
(CustomerNo varchar2 (20),
 Name varchar2(25),
 Address varchar2 (100),
 Events eventNestedtable)
nested table Events store as EventNestedtable_tab;

解决方案 »

  1.   

    这个表性能优化非常的不好做,小表罢了,大表的话要慎用
    SQL> conn scott
    Enter password: *****
    Connected.
    SQL> Create or replace type Event_Type as object
      2  (  EventId varchar2(250),
      3     Description varchar2 (250),
      4     EventDate date,
      5     Location varchar2(100)) 
      6  ;
      7  /Type created.SQL> Create or replace type EventNestedtable as table of Event_Type; 
      2  /Type created.SQL> Create table CateringCustomer
      2  (  CustomerNo varchar2 (20),
      3     Name varchar2(25),
      4     Address varchar2 (100),
      5     Events eventNestedtable)
      6  nested table Events store as EventNestedtable_tab;Table created.
    SQL> insert into CateringCustomer values
      2  ('aaa','bbb','ccc', EventNestedtable(Event_Type('ddd','eee', sysdate, 'fff')) );1 row created.SQL> insert into CateringCustomer values
      2  ('aaa','bbb','ccc', EventNestedtable(Event_Type('ddd','eee', sysdate, 'fff'), Event_Type('ggg',
    'hhh', sysdate, 'iii')) );1 row created.