In my procedure I have two tables with the same data. I go through my first table through a cursor. Which compares with the second table that I find much the same data. What if, for example in my table_1 I have ten in my data and I have 12 data table2 how to detect missing data in my two table_1 which is traversed by the cursor?
Thx.
Sounds very much like you’d be better off using the MINUS operator.
This will show you all results that exist in table1 which are not present in table2. In order to show discrepancies both ways, you could do something like this:
SQL Fiddle for this answer