Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
);
like image 575
cildoz Avatar asked Jan 28 '26 23:01

cildoz


1 Answers

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.

like image 87
Dina Bogdan Avatar answered Jan 31 '26 13:01

Dina Bogdan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!