drop type ADDRESS force;
create or replace type ADDRESS as  object  
(  
       PROVINCE varchar(10),  
       CITY varchar(20 ),  
       STREET varchar(30)  
);
/drop type person force;
create or replace type person as object
(
       pname  varchar(30) ,
       ads  ref ADDRESS
)
/drop table address_WORK_TAB force;
create table  address_WORK_TAB of ADDRESS(PRIMARY KEY(PROVINCE,CITY,STREET)) OBJECT IDENTIFIER IS PRIMARY KEY;
/
drop table person_WORK_TAB force;
create table  person_WORK_TAB of person(PRIMARY KEY(pname)) OBJECT IDENTIFIER IS PRIMARY KEY;
/
select t.*, t.rowid from PERSON_WORK_TAB t
update PERSON_WORK_TAB set ads=make_ref(address_WORK_TAB,'1','1','1');   
 查了几条纪录后 最后一局报错:ORA-22979

解决方案 »

  1.   

    create or replace procedure test_ref is
      addref ref address ;
    begin
      select ref(a) into addref from address_WORK_TAB a where street='1';
      insert into PERSON_WORK_TAB values ('ya',addref);  commit;
    end test_ref;这样也插不进去。。
      

  2.   

    少了一个分号。
    并且【select t.*, t.rowid from PERSON_WORK_TAB t】,这句是做什么用,没看懂。
      

  3.   

    select ref(a) into addref from address_WORK_TAB a where street='1';
    这个可以保证数据的唯一性吗/