SELECT * FROM
(
SELECT city from addr_tab
UNION ALL
SELECT 'zzzz' AS city from dual
)ORDER BY city
I am using the above approach to retrieve the ‘zzzz’ as last record of the table. But I don’t think this would work all the time, as the city theoretically might be something bigger than “zzzz” alphabetically. Is there any other robust approach to get this harcoded record as the last record?. I need this for reporting using oracle reports. Any help would be most welcome.
Well, as others have said (in comment and answer) there is probably a better way to approach the problem from the beginning; but if you need a temporary hack read on!…
Call the last record whatever you want…
‘zzzz’ is fine…
and then use a custom
ORDER BYlike: