Need to compare the rowcount for 2 tables to see if they're identical or not, in a single sql statement. Here's what I got...
Code:
SELECT TABLE_NAME,(CASE
WHEN (SELECT COUNT(*) FROM TMP_JP_W_PERSON) =
(SELECT COUNT(*) FROM W_PERSON)
THEN 'ROWMATCH'
ELSE 'NO MATCH'
END) "NUM OF ROWS"
FROM USER_TABLES
WHERE TABLE_NAME = 'TMP_JP_W_PERSON';
TABLE_NAME NUM OF ROWS
------------------------- -----------
TMP_JP_W_PERSON NO MATCH
There has to be a much more elegant way of doing this. Code is not my strong point.
Any help would be appreciated.