In Oracle 10g, I have this SQL:
select dog.id as dogId from CANINES dog order by dog.codename asc
which returns:
id
--
204
203
206
923
I want to extend this query to determine the oracle rownum of a dog.id in this resultset.
I have tried
select rownum from
(select dog.id as dogId from CANINES dog order by dog.codename asc)
where dog.id=206
But this does not work out very well (it returns 1 no matter which dog.id I match on). I was expecting to get back 3.
Thanks for your help!
Notes
http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
I am pretty sure I do not need to use rowid