Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL Query to sum all digits in a given number (eg. 321=6)

Don07Jun 4 2016 — edited Jun 6 2016

Hello There,

I would like to know how to write a SQL query to sum all digits in a given number.

example: Number is 123456

              Sum is 21 = 1+2+3+4+5+6

Many thanks

Regards,

Don

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2016
Added on Jun 4 2016
26 comments
12,838 views