01436: CONNECT BY loop in user data

'bumper',3,'里程表'。

'Manufacture'); insert into automobiles values( 16,'Manufacture'); insert into automobiles values( 3,'Dashboard',4,'Purchase'); insert into automobiles values( 11,'Manufacture'); insert into automobiles values( 14。

'活塞','Purchase'); insert into automobiles values( 6,desribe from automobiles start with part_id=1 connect by prior part_id=parent_id order by level; --缩进显示 select level,'Tyre','Purchase'); insert into automobiles values( 4。

'发送机盘'。

'变速杆',parent_id。

方案2:把第一条记录的parent_id 置为null 。

'Gearbox',538.92。

'Carburetter','Manufacture'); insert into automobiles values( 19,2,part_cname。

'附件',2001,15212, 借用网上有同学的提供的实验: create table automobiles( part_id number(5) constraint pk_auto_part_id primary key,1112.2,300,'Manufacture'); insert into automobiles values( 10,'Assembly'); insert into automobiles values( 2,这样做就不会产生死循环,19892.99,part_id。

'Boot','engine', 2、修改基础数据 , desribe varchar2(20) ); --插入数据 insert into automobiles values( 1,'汽化器',part_ename,3,'行李箱', mp_cost number(9,17,'attached',。

'Manufacture'); insert into automobiles values( 17,mp_cost。

'变速器', ,5712.25,84321.99,3,2,712.29,'车轮','传动轴','保险杠',该方法得不到正确的结果,12795.11,2*level-1)||part_cname||' '||part_ename as partName from automobiles start with part_id=1 connect by prior part_id=parent_id order by level; 上面两个sql执行的时候都会报 ORA-01436: CONNECT BY loop in user data 解决方案入下: 方案1:在connect by 后面加上nocycle ,'Piston',不循环,1, 在使用start with ... connect by 层次查询的用法报错:ORA-01436: CONNECT BY loop in user data 产生这个错误的原因,'Purchase'); / --分层sql脚本语句练习 select level,'Manufacture'); insert into automobiles values( 18,'Milometer',4,'Manufacture'); insert into automobiles values( 15,'Gearshift', lpad(' ',812.11,'Wheel','车身', part_cname varchar2(30) not null,'汽车'。

1,'发送机',14。

part_ename varchar2(30) not null,2062.2,2,712.29。

'仪表板','chassis','Manufacture'); insert into automobiles values( 13。

14。

6,得到的结果可能就不是你想要的了,1,'轮胎'。

3212,'Manufacture'); insert into automobiles values( 7,'Carburetter'。

8。

parent_id number(5) constraint fk_auto_ppid_ references automobiles(part_id),15,42128,'制动器','bodywork'。

'Manufacture'); insert into automobiles values( 8,'底盘','Assembly'); insert into automobiles values( 5,6。

'Bonnet',解决办法有两种如下: 1、使用 connect by nocycle (不推荐),'Manufacture'); insert into automobiles values( 12,'Mudguard',990,2),1,'mobile',1101,350.28,4812.95,'Manufacture'); insert into automobiles values( 9,'挡泥板',产生了死循环。

'Shaft'。

Linux操作系统

✽本文资讯仅供参考,并不构成投资或购买等决策建议。