This is like adding an auto-incremented column to a query result:
select result.*, rownum from ( select … ) result;
select … is the sub query that doesn’t include the row number. This method is esp. useful when the sub query uses union.
There are times when we need to do some quick test to see if the select query that we build returns reasonable results, here’s a quick solution, type the following into the sql console:
select count(*) from ( select… )
The select… is the query being tested. This is useful when the number of rows returned by select… is huge.