0

Inserting multiple rows in a single Oracle SQL query. Here is the following query I am trying to use. Can anyone tell me the error that I am having and how to go about it. Thanks.

INSERT ALL INTO 
     "SCOTT"."GREATCOLOR1" (
           COLOR, 
           PAUL, 
           JOHN, 
           TIM, 
           ERIC
     )VALUES (
           'White', 
           '1', 
           '5', 
           '1', 
           '3') 
     INTO "SCOTT"."GREATCOLOR1" (
           COLOR, 
           PAUL, 
           JOHN, 
           TIM, 
           ERIC
    )VALUES (
           'Yello', 
           '8', 
           '4', 
           '3', 
           '5') 
    INTO "SCOTT"."GREATCOLOR1" (
           COLOR, 
           PAUL, 
           JOHN, 
           TIM, 
           ERIC
    ) VALUES (
           'Black', 
           '2', 
           '2', 
           '9', 
           '1') 
    SELECT * FROM dual;
7
  • 1
    insert into t1 select ... from ... Commented May 26, 2016 at 11:48
  • INSERT ALL INTO "SCOTT"."GREATCOLOR1" (COLOR, PAUL, JOHN, TIM, ERIC) VALUES ('White', '1', '5', '1', '3') INTO "SCOTT"."GREATCOLOR1" (COLOR, PAUL, JOHN, TIM, ERIC) VALUES ('Yello', '8', '4', '3', '5') INTO "SCOTT"."GREATCOLOR1" (COLOR, PAUL, JOHN, TIM, ERIC) VALUES ('Black', '2', '2', '9', '1') SELECT * FROM dual; Commented May 26, 2016 at 11:48
  • what is the mistake in the above oracle sql query Commented May 26, 2016 at 11:49
  • It is traditional for a question to have, well, a question. Commented May 26, 2016 at 11:51
  • Possible duplicate of Inserting multiple rows in a single SQL query? Commented May 26, 2016 at 12:00

1 Answer 1

1

You where close, but you have much to learn.

Here is how you could do it:

INSERT INTO "SCOTT"."GREATCOLOR1" (COLOR, PAUL, JOHN, TIM, ERIC)
          select 'White', '1', '5', '1', '3' from dual
union all select 'Yello', '8', '4', '3', '5' from dual
union all select 'Black', '2', '2', '9', '1' FROM dual
;
Sign up to request clarification or add additional context in comments.

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.