cildoz
cildoz

Reputation: 436

Inserting data into Oracle database

I've been trying for a while inserting data into an Oracle database but, just in some cases, I'm getting the following error:

INSERT INTO Estadio VALUES ('Camp Nou', 1957, 99354​)
                                                   *
ERROR at line 1:
ORA-00917: missing comma

Here's part of my code:

INSERT INTO Estadio VALUES ('Camp Nou', 1957, 99354​);
INSERT INTO Estadio VALUES ('Santiago Bernabeu', 1947, 81044​);
INSERT INTO Estadio VALUES ('Wanda Metropolitano', 2017​, 67829​);
INSERT INTO Estadio VALUES ('Benito Villamarin', 1929, 60722​);
INSERT INTO Estadio VALUES ('San Mames', 2013, 53289​);

I'm confused because, as far as I know, there should be no problem with commas. Thanks in advance!

Here's my create database statement:

CREATE TABLE Estadio (
nombreEstadio       VARCHAR(60) CONSTRAINT PK_Estadio       PRIMARY KEY,
inauguracion        NUMBER      CONSTRAINT NN_inauguracion  NOT NULL,
capacidad           NUMBER      CONSTRAINT NN_capacidad     NOT NULL
);

Upvotes: 3

Views: 92

Answers (1)

Dina Bogdan
Dina Bogdan

Reputation: 4738

Try the following statement:

INSERT INTO Estadio (nombreEstadio, inauguracion, capacidad) VALUES ('Camp Nou', 1957, 99354);

It's a best practice to specify the order of the columns for INSERT INTO statement.

Upvotes: 2

Related Questions