Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL error "ORA-01722: invalid number"

A very easy one for someone, The following insert is giving me the

ORA-01722: invalid number

why?

INSERT INTO CUSTOMER VALUES (1,'MALADY','Claire','27 Smith St Caulfield','0419 853 694');
INSERT INTO CUSTOMER VALUES (2,'GIBSON','Jake','27 Smith St Caulfield','0415 713 598');
INSERT INTO CUSTOMER VALUES (3,'LUU','Barry','5  Jones St Malvern','0413 591 341');
INSERT INTO CUSTOMER VALUES (4,'JONES','Michael','7  Smith St Caulfield','0419 853 694');
INSERT INTO CUSTOMER VALUES (5,'MALADY','Betty','27 Smith St Knox','0418 418 347');
like image 759
Phillip Gibson Avatar asked Sep 23 '12 01:09

Phillip Gibson


People also ask

How do I fix this error ORA-01722 invalid number?

In the event of using INSERT or UPDATE to supply values to a sub query, the ORA-01722 will be hidden. You will have to find the row that is supplying an invalid numerical string and resolve it. If instead of INSERT you attempt SELECT, the error will derive from an implicit conversion in the WHERE clause.

What is invalid number error in SQL?

What Is the Invalid Number Error? The invalid number error happens when Oracle attempts to convert a string to a number field but can't. This is often because the supplied string value is not a number (e.g. it is a letter or punctuation character). You'll get an error like this in your output: ORA-01722: invalid number.

How do I find an invalid number in SQL?

Check the character strings in the function or expression. Check that they contain only numbers, a sign, a decimal point, and the character “E” or “e” and retry the operation. Solution: If my table having inserted last night some character or special character instead of numeric value or decimal numeric value.

Is number function in Oracle?

The Oracle numeric functions take a numeric input as an expression and return numeric values. The return type for most of the numeric functions is NUMBER. Calculates the absolute value of an expression. Calculates the angle value (in radians) of a specified cosine.


1 Answers

An ORA-01722 error occurs when an attempt is made to convert a character string into a number, and the string cannot be converted into a number.

Without seeing your table definition, it looks like you're trying to convert the numeric sequence at the end of your values list to a number, and the spaces that delimit it are throwing this error. But based on the information you've given us, it could be happening on any field (other than the first one).

like image 89
Aaron Avatar answered Sep 21 '22 12:09

Aaron