SQL error ORA-01722 invalid number

0 votes
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');

This query is giving me error
Can you check and tell me the error?

Feb 15, 2022 in Database by Vaani
• 7,070 points
3,115 views

1 answer to this question.

0 votes

When an effort is made to convert a character string into a number and the string cannot be turned into a number, an ORA-01722 error occurs.

Without looking at your table design, it appears like you're attempting to convert the numeric sequence at the end of your values list to a number, and the spaces delimiting it are causing this problem. However, depending on the information you've provided, it might occur on any field (other than the first one).

One way to solve it can be by removing non-numeric characters then cast it as a number.

cast(regexp_replace('0419 853 694', '[^0-9]+', '') as number)
answered Feb 15, 2022 by Neha
• 9,020 points

Related Questions In Database

0 votes
1 answer

SQL Error: ORA-00922: missing or invalid option

The lack of an underscore between "chartered" ...READ MORE

answered Sep 15, 2022 in Database by narikkadan
• 63,680 points
2,236 views
0 votes
0 answers

PL/SQL ORA-01422: exact fetch returns more than requested number of rows

I am getting this error: DECLARE * ERROR at line ...READ MORE

Aug 19, 2022 in Database by Kithuzzz
• 38,020 points
1,090 views
0 votes
0 answers

SQL Error: ORA-00942 table or view does not exist

I'm using SQL Developer, and after creating ...READ MORE

Sep 4, 2022 in Database by Kithuzzz
• 38,020 points
1,036 views
0 votes
0 answers

SQL Error: ORA-00913: too many values

The table name, column names, datatype, and ...READ MORE

Sep 5, 2022 in Database by Kithuzzz
• 38,020 points
1,686 views
0 votes
1 answer

Please name some online websites to compile and run PL/SQL?

For executing Oracle SQL queries and PL/SQL ...READ MORE

answered Feb 11, 2022 in Database by Neha
• 9,020 points
1,408 views
0 votes
1 answer

Number of rows affected by an UPDATE in PL/SQL

You can try using the following query: SELECT ...READ MORE

answered Feb 14, 2022 in Database by Vaani
• 7,070 points
1,302 views
0 votes
0 answers

ORA-06502: PL/SQL: numeric or value error: character string buffer too small

I experimented with the following code in ...READ MORE

Aug 22, 2022 in Database by Kithuzzz
• 38,020 points
6,391 views
0 votes
1 answer

Oracle PL/SQL - ORA-01403 "No data found" when using "SELECT INTO"

Just populate the field directly, using ordering ...READ MORE

answered Sep 18, 2022 in Database by narikkadan
• 63,680 points
5,493 views
0 votes
1 answer

Ordering by the order of values in a SQL IN() clause

Use MySQL's FIELD() function: SELECT name, description, ... FROM ... WHERE id ...READ MORE

answered Feb 4, 2022 in Database by Neha
• 9,020 points
5,214 views
0 votes
1 answer

How to drop all tables from a database with one SQL query?

Use the INFORMATION_SCHEMA.TABLES view to get the ...READ MORE

answered Feb 4, 2022 in Database by Neha
• 9,020 points
8,936 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP