Invalid number error
This:


  cast(to_char(total_price, 'C9,999,999.00')as integer), 


is wrong. 

Assuming total_price is defined as number the result of converting e.g. 1234.56 will be:

EUR1,234.56 


(the exact output depends on your NLS settings).

Now the string EUR1,234.56 is not a valid number any more (at least not to a computer). So your cast to an integer fails. 

If you only want to display the total price as a formatted string, only to_char() is required. Remove the cast()