Home » SQL & PL/SQL » SQL & PL/SQL » INSERT INTO with multiple (!) VALUES possible ?
INSERT INTO with multiple (!) VALUES possible ? [message #222442] Sun, 04 March 2007 17:06 Go to next message
pstein
Messages: 7
Registered: February 2007
Junior Member
I specified an INSERT SQL Statment similar to

IMSERT
INTO mytable (.........)
Values (........),
Values (........),
Values (........);

To enter multiple data records in ONE INSERT statment.

Unfortuantely this command syntax is not accepted (by Toad).
An error message was shown similar to: "Command terminated invalid". The cursor was placed at the first comma
after the first Values term.

So what's wrong ?

How can I enter multiple records at once otherwise?

Or do I really have to write one INSERT statement for
every record ?

Peter
Re: INSERT INTO with multiple (!) VALUES possible ? [message #222445 is a reply to message #222442] Sun, 04 March 2007 19:23 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
I can only conclude you are a slow learner & refuse to research your own problems
The whole Oracle Dumentation set can be found at http://tahiti.oracle.com
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/toc.htm
contains the answer to your most recent RTFM question.
Re: INSERT INTO with multiple (!) VALUES possible ? [message #222487 is a reply to message #222442] Mon, 05 March 2007 02:45 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It can be done, but not the way you have put it. After you learn the correct syntax (it can be found under the INSERT statement, chapter 18 of the documentation page Anacedent provided) (search for "multitable insert"), you will be able to do something like this:
SQL> insert <here goes what you need to find out>
  2    into test values (1)
  3    into test values (2)
  4    into test values (3)
  5  select * from dual;

3 rows created.

SQL>
Re: INSERT INTO with multiple (!) VALUES possible ? [message #222664 is a reply to message #222487] Mon, 05 March 2007 19:10 Go to previous message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Ingenious! Ridiculous, but ingenious. Wink
Previous Topic: constraints
Next Topic: to parse a file name
Goto Forum:
  


Current Time: Thu Dec 05 15:41:12 CST 2024