-2

Who gives me an example of the total salary this

 Select sum(to_char(salary,'9,999,999')) from employees;

Output Ora-01722

6

1 Answer 1

2

You are converting to character before you complete the sum, which must be done to a number. Reverse the order of your functions - do all the math before you change the data type to char:

select to_char(sum(salary),'9,999,999') from employees;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.