lena
lena

Reputation: 89

how to solve the following oracle error invalid number

i want to ask you when i execute the following sql statement

 SELECT account_identifier,least(to_number(part_1)),least (to_number(part_2)) FROM TEST5 ;

i get the following error

   ORA-01722: invalid number
   01722. 00000 -  "invalid number"
   *Cause:    
   *Action:

you should know that when i execute the following sql statement

  SELECT account_identifier,to_number(part_1),to_number(part_2) FROM TEST5 ;

it works fine

Upvotes: 0

Views: 779

Answers (1)

beiller
beiller

Reputation: 3135

Most likely your part_1 column, or part_2 column, contains a null, or a string value.

Try the following to discover the row that causes this issue:

SELECT * FROM TEST5 WHERE part_1 IS NULL or part_2 IS NULL;

If NULL is your issue perhaps you could solve with the following:

SELECT account_identifier,least(to_number(part_1)),least (to_number(part_2)) FROM TEST5 WHERE part_1 IS NOT NULL and part_2 IS NOT NULL;

Upvotes: 1

Related Questions