如何更新引用类型字段?make_ref报错(急~~~~~~~~)

君望永远 2012-01-13 10:55:27
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
...全文
134 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
君望永远 2012-01-13
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 zyuc_wangxw 的回复:]

你这是什么数据库啊?
[/Quote] Oracle 11g
qinglang1987 2012-01-13
  • 打赏
  • 举报
回复
你这是什么数据库啊?
君望永远 2012-01-13
  • 打赏
  • 举报
回复
人呢~~~~~~~~~~
君望永远 2012-01-13
  • 打赏
  • 举报
回复
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;
这样也插不进去。。。。。
raymonshi 2012-01-13
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 binyao02123202 的回复:]

SQL code
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)……
[/Quote]
select ref(a) into addref from address_WORK_TAB a where street='1';
这个可以保证数据的唯一性吗/
raymonshi 2012-01-13
  • 打赏
  • 举报
回复
[Quote=引用楼主 binyao02123202 的回复:]
SQL code
drop type ADDRESS force;
create or replace type ADDRESS as object
(
PROVINCE varchar(10),
CITY varchar(20 ),
STREET varchar(30)
);
/

drop type person force;
……
[/Quote]
少了一个分号。
并且【select t.*, t.rowid from PERSON_WORK_TAB t】,这句是做什么用,没看懂。

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧