Abdullah
Abdullah

Reputation: 1

Oracle: SELECT to_number('3+11+7') FROM dual; gives ora-01722

I am using oracle 11g R2. When i query SELECT to_number('3+11+7') FROM dual. It gives ora-01722. and when i remove single quotes, SELECT to_number(3+11+7) FROM dual. Then it gives answer 21. I just removed single quotes from string. How can i do it with built in functions. Thanks.

Upvotes: 0

Views: 96

Answers (1)

Alex Poole
Alex Poole

Reputation: 191305

You could pass evaluation of the expression to XML:

select to_number(xmlquery('3+11+7' returning content)) from dual;

db<>fiddle

Upvotes: 2

Related Questions