How to count unique rows in Oracle
It depends on what you are trying to accomplish. To get a count of the distinct rows by specific column, so that you know what data exists, and how many of that distinct data there are:
SELECT DISTINCT
A_CODE, COUNT(*)
FROM MY_ARCHV
GROUP BY A_CODE
--This informs me there are 93 unique codes, and how many of each of those codes there are.
Another method
--How to count how many of a type value exists in an oracle table:select A_CDE
, --the value you need to countcount(*) as numInstances
--how many of each valuefrom A_ARCH
-- the table where it residesgroup by A_CDE
-- sorting method
Either way, you get something that looks like this:
A_CODE Count(*)
1603 32
1600 2
1605 14
How about
SELECT COUNT(*)
FROM (SELECT DISTINCT * FROM Table)