Dogar
Dogar

Reputation: 23

ORA-01722: invalid number Error

I am facing titled error while execution of below query.

select to_number('FROM1', 'xxxxxxx') from dual;

Error ORA-01722: invalid number

FROM1 values can be:

F1F65
F20B5
F204D

Please suggest solution. I need to convert these values to a number. For example, F1F65 will be converted to 991077 using below query.

select to_number('F1F65', 'xxxxxxx') from dual;

Upvotes: 1

Views: 873

Answers (2)

Renzo
Renzo

Reputation: 27414

You should use

select to_number(FROM1, 'xxxxxxx') from dual;

otherwise Oracle interprets FROM1 as a string, and not as a variable.

Upvotes: 2

Raghvendra
Raghvendra

Reputation: 134

select to_number(hex_value,'xxxxxxx')  
  from hex;  

SQL Fiddle Demo

Upvotes: 0

Related Questions