inserting data into oracle sql live

3778 views sql
7

Im trying to insert data into a table i created on Oracle SQL live. I was able to enter the data in one row at a time but when i try to enter it all at the same time, i get an error message that says SQL command not properly ended. Im using the code below. I don't know what i'm doing wrong:

Insert into PET_OWNER (OwnerID, OwnerLastName , OwnerFirstName , OwnerPhone , OwnerEmail) 
Values (1, 'Downs' , 'Marsha' , '555-537-8765' , 'Marsha.downs@somewhere.com'), 
Values (2 , 'James' , 'Richard' , '555-537-7654' , 'Richard.James@somewhere.com'),  
Values (3 , 'Frier' , 'Liz' , '555-537-6543' , 'Liz.Frier@somewhere.com'),  
Values (4 , 'Trent' , 'Miles' , 'Miles.Trent@somewhere.com');  

answered question

2 Answers

5

try like below

Insert into PET_OWNER (OwnerID, OwnerLastName , OwnerFirstName , OwnerPhone , OwnerEmail) 
Values (1, 'Downs' , 'Marsha' , '555-537-8765' , 'Marsha.downs@somewhere.com');
 Insert into PET_OWNER (OwnerID, OwnerLastName , OwnerFirstName , OwnerPhone , OwnerEmail)
Values (2 , 'James' , 'Richard' , '555-537-7654' , 'Richard.James@somewhere.com');
Insert into PET_OWNER (OwnerID, OwnerLastName , OwnerFirstName , OwnerPhone , OwnerEmail)  
Values (3 , 'Frier' , 'Liz' , '555-537-6543' , 'Liz.Frier@somewhere.com');
Insert into PET_OWNER (OwnerID, OwnerLastName , OwnerFirstName , OwnerPhone , OwnerEmail)  
Values (4 , 'Trent' , 'Miles' , 'Miles.Trent@somewhere.com');

posted this
0

To insert multiple tuples into a SQL table, you only need to specify the VALUES keyword once. So, the following should work:

INSERT INTO PET_OWNER (OwnerID, OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail)
VALUES
     (1, 'Downs', 'Marsha', '555-537-8765', 'Marsha.downs@somewhere.com'),
     (2, 'James', 'Richard', '555-537-7654', 'Richard.James@somewhere.com'),
     (3, 'Frier', 'Liz', '555-537-6543', 'Liz.Frier@somewhere.com'),
     (4, 'Trent', 'Miles', 'Miles.Trent@somewhere.com');

posted this

Have an answer?

JD

Please login first before posting an answer.