1

I already have a table built in oracle. Im trying to insert some data like this:

INSERT INTO movies_actor('name','id')  
VALUES  ('Nuno','2'),  ('Pedro','3'),  ('Jose','1');
select * from movies_actor;

I always get this error

ORA-00928: missing SELECT keyword

What am I doing wrong?

1

4 Answers 4

1

I don't think you need the single quote around your field names.

Sign up to request clarification or add additional context in comments.

1 Comment

upvoted because Brandon does not enough enough reputation for comments.
0

You need to do:

INSERT INTO TableName(Column1, Column2) 
VALUES('Nuno', '2');

In your example, it would be:

INSERT INTO movies_actor(name, id)  
VALUES ('Nuno','2');

INSERT INTO movies_actor(name, id)  
VALUES ('Pedro','3');

INSERT INTO movies_actor(name, id)  
VALUES ('Jose','1');

select * from movies_actor;

Comments

0

Another way.

insert into table
(field1, field2)
select value1, value2
from dual
union
select value3, value4
from dual
etc

Comments

0

You cannot insert multiple records in one statement using VALUES. You can either use Tenzin's solution or use INSERT ALL :

INSERT ALL
    INTO movies_actor(name, id) VALUES ('Nuno', '2')
    INTO movies_actor(name, id) VALUES ('Pedro', '3')
    INTO movies_actor(name, id) VALUES ('Jose', '1')
SELECT * FROM dual;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.