magnifying-glass-spreadsheet-shutterstock-kuzma

 

I share a simple query to find duplicates in all  columns that compounds our tables in the project

SELECT '/* '|| AB.TABLE_NAME || ' */        SELECT ' || AB.COLUMN_NAME ||', COUNT(1) AS DUPLICADOS FROM ' || AB.TABLE_NAME || ' GROUP BY '|| AB.COLUMN_NAME ||' HAVING COUNT(1)>1;' FROM(SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE FROM ALL_TAB_COLUMNS WHERE TABLE_NAME LIKE '%' -- CONDITIONORDER BY 1, 2) ABGROUP BY AB.TABLE_NAME, AB.COLUMN_NAMEORDER BY AB.TABLE_NAME, AB.COLUMN_NAME;

 Best regards