The original problem may be that the tool you are using to execute the query has removed all the carriage returns. The SQL has ended up as:

select .. and rownum = 1 -- order by ctime desc )

Obviously this comments the closing bracket as well as the order by.