Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2002
    Posts
    20

    Question Unanswered: insert into with multiple values

    Is it possible with oracle 8 (without using any stored procedure) to use the INSERT INTO command for creating several rows without repeating it as much as rows to be inserted ?
    Something like :
    INSERT INTO table (alpha1, year2)
    VALUES ('xxxx',2002,'yyyy',2003,'zzzz',2004)

    ????

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: insert into with multiple values

    Originally posted by zedude
    Is it possible with oracle 8 (without using any stored procedure) to use the INSERT INTO command for creating several rows without repeating it as much as rows to be inserted ?
    Something like :
    INSERT INTO table (alpha1, year2)
    VALUES ('xxxx',2002,'yyyy',2003,'zzzz',2004)

    ????
    No, an INSERT...VALUES statement can only insert one row in Oracle (any version), though apparently other DBMSs work differently.

    In Oracle you would have to either run 3 INSERT...VALUES statements or you could do this:

    INSERT INTO table (alpha1, year2)
    SELECT 'xxxx',2002 FROM DUAL
    UNION ALL
    SELECT 'yyyy',2003 FROM DUAL
    UNION ALL
    SELECT 'zzzz',2004 FROM DUAL;

  3. #3
    Join Date
    Mar 2002
    Posts
    20
    Ok thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •