View previous topic :: View next topic
|
Author |
Message |
J.P.R.Kumar
New User
Joined: 02 Apr 2008 Posts: 11 Location: Chennai
|
|
|
|
Hi all,
can we insert multiple rows using single insert statement, the code is as follows, but this is not working, can some one help .
insert into employ
(001,'phani','l&t infotech chennai'),
(002,'mani','l&t infotech chennai'),
(003,'ani','l&t infotech chennai'); |
|
Back to top |
|
|
ascelepius
New User
Joined: 16 Jun 2008 Posts: 35 Location: bangalore
|
|
|
|
No you cannot, DB2 manuals say,
Quote: |
There are three forms of this statement:
- The INSERT via VALUES form is used to insert a single row into the table or view using the values provided or referenced.
- The INSERT via SELECT form is used to insert one or more rows into the table or view using values from other tables, or views, or both.
- The INSERT via FOR n ROWS form is used to insert multiple rows into the table or view using values provided from host-variable arrays. |
regards,
asci(i) |
|
Back to top |
|
|
J.P.R.Kumar
New User
Joined: 02 Apr 2008 Posts: 11 Location: Chennai
|
|
|
|
hi ascelepius,
The db2 manual only says that there is a provision for the insertion of multiple rows using single insert statement (the code which i pasted is a ex.). but when i tried its not working. |
|
Back to top |
|
|
ascelepius
New User
Joined: 16 Jun 2008 Posts: 35 Location: bangalore
|
|
|
|
Well, if you read the manual carefully you will note that this can be achieved only with host variables/arrays...
regards,
asci(i) |
|
Back to top |
|
|
abhishekmdwivedi
New User
Joined: 22 Aug 2006 Posts: 95 Location: india
|
|
Back to top |
|
|
abhishekmdwivedi
New User
Joined: 22 Aug 2006 Posts: 95 Location: india
|
|
Back to top |
|
|
ascelepius
New User
Joined: 16 Jun 2008 Posts: 35 Location: bangalore
|
|
|
|
@abhishek
Oops! I refer to the DB2 manuals for ZO/S( i didnot google).
You are right. I overlooked the fact that queries related to DB2 UDB on non-mainframe could appear here.
For DB2 V8 on Z O/S, this is not possible
regards,
asci(i) |
|
Back to top |
|
|
|