Hello -
I have an insert in a package that basically does an "Insert Into <Table> Select.....".
The problem I'm having is that, as part of the result set, I'm doing a
case when rownum > 1 then chr(13)||'----------------------------------------------------------------------------------------------------------------------------'
||chr(10) else null end
I included this in order to give myself a separator between rows returned. This works fine but then at the end of the select statement I tell it to ORDER BY rownum. For some reason when the insert is made to the table it is not ordering by rownum correctly.
I have done this in several other procedures and it works fine. This one even works fine in our development environment but in test it will not order correctly. I have to do it this way because one of the procedures that is called (after the insert is made) simply selects the results that were inserted and dumps them into an email, and I cannot change this procedure.
Does anyone have any idea why this would not be working? When I run just the select part separately (outside of the pacakge) it orders correctly.
Any help would be greatly appreciated.
Thanks,
Christine