SELECT dnr.RTAG_ID, dnr.PV_ID AS LAST_PV_ID, pv.PV_ID AS NEW_PV_ID
FROM RELEASE_CONTENT rc, DO_NOT_RIPPLE dnr, PACKAGE_VERSIONS pv
WHERE rc.PV_ID = pv.PV_ID
AND rc.RTAG_ID = dnr.RTAG_ID
AND pv.DLOCKED = 'Y'
AND pv.LAST_PV_ID = dnr.PV_ID
AND pv.PV_ID != dnr.PV_ID
ORDER BY LAST_PV_ID

