Question:
Having trouble inserting data into table SQL?
2012-11-19 10:26:50 UTC
I can't seem to figure out why data won't insert into my table... this is the table in question

CREATE TABLE CARS
(REGISTRATION VARCHAR2 (20),
CAR_MAKE VARCHAR2 (20),
WARRANTY VARCHAR2 (8),
MILAGE NUMBER(6)NOT NULL,
CONSTRAINT CARS_PRIMARY_KEY
PRIMARY KEY (REGISTRATION)
);

and this is the data that i'm trying to insert

INSERT INTO CARS
VALUES
('1','KK04ERT','BMW','ONE_YEAR','30500')

and the error it gives me is ORA-00913: too many values

can anyone help me out please?
Five answers:
2012-11-19 10:48:34 UTC
What are those ''1''s.

You need more variation. You have more values than variables.
2016-05-18 07:29:35 UTC
You are doing it wrong. Look at where you are getting the data FROM, no kind of input should return a comma in stead of a decimal point. ALWAYS ensure entered data can only end up as the required type, or yo are opening yourself up to sql injection and site hacking.
Serge M
2012-11-19 22:29:24 UTC
Try this

INSERT INTO CARS

VALUES

('KK04ERT','BMW','ONE_YEAR','30500');
FatGuy
2012-11-19 10:29:35 UTC
you have more values than variables.

whats the "1"?
Tanisha
2012-11-19 10:29:14 UTC
What is the '1'? That seems to be surplus to requirements.



? - 1

REGISTRATION - KK04ERT

CAR_MAKE - BMW

WARRANTY - ONE_YEAR

MILAGE (spelled mileage) - 30500


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...