Need to invert the result of a CONNECT BY query
376519Feb 12 2009 — edited Feb 15 2009I have two tables. One that we put Oracle EBS patches into and the other table links them to a third table that has Issues. In the first table EBIZ_PATCH I have a PK column PATCH_UID and column named IS_PRE_REQ_FOR_UID. The IS_PRE_REQ_FOR_UID column holds the PATCH_UID for the patch that requires this patch to be installed before it. I would like to query this data to show the patches for an issue and the order the patches must be applied in when a Pre-Req is involved.
This is the SQL I have, and it shows the parent first and then the pre-req. I need the pre-req to come before the parent.
select
PFI.PATCH_FOR_ISSUE_UID,
PFI.PATCH_UID,
PFI.ISSUE_ID,
P.ORACLE_PATCH_NUMBER,
LEVEL
from
EBIZ_PATCH_FOR_ISSUE PFI,
EBIZ_PATCH P
where
P.PATCH_UID = PFI.PATCH_UID
and PFI.ISSUE_ID = :P7_ISSUE_ID
start with
P.IS_PRE_REQ_FOR_UID is null
connect by prior P.PATCH_UID = P.IS_PRE_REQ_FOR_UID