Coolguy23
Coolguy23

Reputation: 37

SQL invalid number error

I am having an issue adding adding something to a table. Here is the table that has been created.

CREATE TABLE LINE (   
INV_NUMBER integer,   
LINE_NUMBER integer,   
P_CODE varchar2(10),   
LINE_UNITS number(9,2),   
LINE_PRICE number(9,2)   
);   

when the table is created, i am trying to add this into the table.

INSERT INTO LINE VALUES('1001','1','13-Q2/P2','1','14.99');

and I keep getting the same error every time. ORA-01722 invalid line. what I am missing, this is a lab for class and this is the codes that the professor sent us to use. Any idea where the issue lies. I have many more lines to add to the table and I cannot figure it out.

Upvotes: 0

Views: 99

Answers (2)

Revan
Revan

Reputation: 1144

Your table contains integer and numeric datatype. But you are using '' in place of integer and numeric field.'' is to be used in case of varchar

Use this below line

INSERT INTO LINE VALUES(1001,1,'13-Q2/P2',1,14.99);

Upvotes: 1

pri
pri

Reputation: 1531

Try this:
INSERT INTO LINE VALUES(1001,1,'13-Q2/P2',1,14.99);
Using single quotes makes it varchar, and numbers/integers should be inserted without quotes.

Upvotes: 2

Related Questions