Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Query Help...

Re: Query Help...

From: Stephane Faroult <sfaroult_at_roughsea.com>
Date: Mon, 23 Jan 2006 10:47:47 +0100
Message-Id: <1138009667.7112.29.camel@frlinux2.roughsea.com>


Deepak,

   Not very difficult. It's a DELETE where FOLDER_ID IN (...) with in the subquery a CONNECT BY that does a bottom up walk (that is, CONNECT BY FOLDER_ID = PRIOR PARENT_ID

          START WITH FOLDER_ID = 005). As a matter of caution, I would probably throw a NO_MERGE hint in.

HTH Stephane Faroult

On Mon, 2006-01-23 at 15:04 +0530, DBA Deepak wrote:
> Hi All,
>
> Have a table like ...
>
> FOLDER_ID PARENT_ID
> ----------------- ---------------
> 001
> 002 001
> 003 002
> 004 003
> 005 004
>
>
> and so on....
>
> The parent_ID is the foreign key referencing FOLDER_ID column of the
> same table.
>
> Want a SQL which deletes the bottom most folder_id i.e., 005 in the
> above case, and then 004 and then 003 ....
>
> Do not want to use cascade delete....
>
>
>
> --
> Regards,
>
> Deepak
> Oracle DBA

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Jan 23 2006 - 03:47:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US