如何使用leaf node = 1更新分层查询

时间:2014-04-26 12:42:39

标签: sql oracle

如何使用leaf node = 1

更新分层查询

并更新它们

UPDATE CUSTOMER SET CLASS='SHIP-TO' (when the leaf=1)

类似的东西,但这不会起作用

UPDATE CUSTOMER SET CLASS='SHIP-TO' 
   WHERE connect_by_isleaf=1 and
   start with cust_id=12660
   CONNECT BY PRIOR cust_id = cust_cust_id;

1 个答案:

答案 0 :(得分:0)

不确定表格和输入数据的结构。但是,也许这会奏效:

UPDATE CUSTOMER SET CLASS='SHIP-TO' 
WHERE cust_id in 
(SELECT cust_id 
FROM CUSTOMER
     CONNECT_BY_ISLEAF=1 
     START WITH id = 12660 CONNECT BY PRIOR cust_id = cust_cust_id)