583: (
584: SELECT lease_id
585: FROM pn_leases_all
586: WHERE location_id in (SELECT location_id
587: FROM pn_locations_all loc
588: START with loc.location_id in (SELECT location_id
589: FROM pn_locations_all
590: WHERE property_id = p_prop_id)
591: CONNECT by prior loc.location_id = parent_location_id)
585: FROM pn_leases_all
586: WHERE location_id in (SELECT location_id
587: FROM pn_locations_all loc
588: START with loc.location_id in (SELECT location_id
589: FROM pn_locations_all
590: WHERE property_id = p_prop_id)
591: CONNECT by prior loc.location_id = parent_location_id)
592: UNION
593: SELECT lease_id
592: UNION
593: SELECT lease_id
594: FROM pn_tenancies_all
595: WHERE location_id in (SELECT location_id
596: FROM pn_locations_all loc
597: START with loc.location_id in (SELECT location_id
598: FROM pn_locations_all
599: WHERE property_id = p_prop_id)
600: CONNECT by prior loc.location_id = parent_location_id)
594: FROM pn_tenancies_all
595: WHERE location_id in (SELECT location_id
596: FROM pn_locations_all loc
597: START with loc.location_id in (SELECT location_id
598: FROM pn_locations_all
599: WHERE property_id = p_prop_id)
600: CONNECT by prior loc.location_id = parent_location_id)
601: );
602: