Do we have any other alternative instead of distinct to remove the duplicates in the result of a query;
The other possibilities, I figured out is group by and union can remove the duplicate rows. But, any of these methods will take so long to operate on a table with the size of around 5000 records and having the join conditions.
The query that I have is as
connect by prior contbyelem=elemid
start with elemid = p.elemid) and
p.elemid != ece.elemid AND
e2.elemid = ece.contbyelem;
This query taking at a minimum of 2-3 hrs to fetch records. But the result is having lot of duplicate records in it: