Если вы не хотите перечислять столбцы, вот один из методов:
select (count(*) <> num_distinct) as has_duplicates
from t cross join
(select count(*) as num_distinct
from (select distinct * from t) t
) tt;
Если у вас есть первичный ключ, то более эффективным методом будет:
select (count(*) <> count(distinct pk)) as has_duplicates
from t;
Относительно эффективный метод с первичным ключом будет:
select (count(*) = 1) as has_duplicates
from (select t.*
from t
where exists (select 1 from t t2 where t2.pk = t.pk and t2.? <> t.?)
fetch first 1 row only
) t;
?
- это столбец / столбцы, которые вас интересуют с точки зрения дубликатов.