Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Query Help...
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-lReceived on Mon Jan 23 2006 - 03:47:47 CST
![]() |
![]() |