I have a query that I use on a MySQL database that orders the result, casting a char database field to integer when possible (when the char string is numeric), so for example the ORDER BY clause that I use on MySQL is:
ORDER BY
   CASE 
   WHEN CONVERT(charfield, SIGNED INTEGER) IS NOT NULL THEN
        CAST(charfield AS SIGNED INTEGER)  
   ELSE 9999999999 END
Where charfield is a database field character(25).
How can I translate this ORDER BY clause for Firebird 2.5?
 
     
    