Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to insert multiple rows in DB2 V 6.1

Status
Not open for further replies.

sauravdb2

Programmer
Dec 10, 2002
3
US
Hi;
I am trying to insert multiple rows in a DB2 table but it i salways giving me error?
DB2 Version : 6.1
I was trying these SQLs in SPUFI.. and it was giving me
error that it was not able to identify the "end-of-statement" after the
first row. Can anyone help me out.
 
Copy / paste the SQL you are using in a thread reply so we can see were syntax needs improving....
There are basically 2 ways to insert data:

Insert into table (x,y,z,..........)
values (x1,y1,z1,.......),
(x2,y2,z2,.......),
(x3,y3,z3,.......)

or through a select :

Insert into table(x,y,z,.......)
Select x,y,z,...........
from table 2
where .....
T. Blom
Information analyst
tbl@shimano-eu.com
 
Yes I think I tried the first method mentioned by you.

Here are the details:-

The SQL statement that I was using was:-
INSERT INTO D2DCIIU.VSN_APP
(ARR_ID_APP,VSN_APP)
VALUES (45764,'54096854'),(874575,'89568686'),(564756,'7756676'));;;

The response I got was :-
---------+---------+---------+---------+---------+---------+---------+---------+
DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL &quot;,&quot;. SOME SYMBOLS THAT MIGHT BE LEGAL ARE: <END-OF-STATEMENT
DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNHPARS SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 0 0 0 -1 316 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'00000000' X'00000000' X'00000000' X'FFFFFFFF'
X'0000013C' X'00000000' SQL DIAGNOSTIC INFORMATION
---------+---------+---------+---------+---------+---------+---------+---------+

The definition of the columns :-

ARR_ID_APP INTEGER NOT NULL,
VSN_APP_ID CHAR(10) NOT NULL
 
Hi,
First thing that strikes me about this is that you appear to have one too many brackets at the end of your values statement, followed by 3 ';', which looks a little odd. I'm not sure that's what your problem is though, as I suspect that you can't do what you are trying to do in SPUFI under DB2 6.1.
The reason I come to this conclusion is that it appears to be objecting to the first ','. If you are just inserting 3 rows, I would abandon the mulptiple update and code:

INSERT INTO D2DCIIU.VSN_APP
(ARR_ID_APP,VSN_APP)
VALUES (45764,'54096854');
INSERT INTO D2DCIIU.VSN_APP
(ARR_ID_APP,VSN_APP)
VALUES (874575,'89568686');
INSERT INTO D2DCIIU.VSN_APP
(ARR_ID_APP,VSN_APP)
VALUES (564756,'7756676');

Hope this helps,
Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top