neethasanand
asked on
ora-01722-"Invalid Number"
I have a table which contains a varchar2 field. This field contains numeric values from 7th letter onwards(eg.1CBCCV1024). i need to find the maximum value of this field. I have tried the following query,
select max(to_number(substr(field name,7))) from tablename;
ERROR at line 1:
ORA-01722: invalid number
thanks
select max(to_number(substr(field
ERROR at line 1:
ORA-01722: invalid number
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks..
there was some invalid data...
neetha
there was some invalid data...
neetha
Probe with this:
select max(to_number(substr(lPAD(
May be not all values are 7 chars long or you have Null values in this column. Verify availability of Null values or shorter data with this:
SELECT MIN(LENGTH(NVL(fieldname, '.')) FROM tablename;
T=Regards,
pm