If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > INSERT into <blah> VALUES <blah> - Umm...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-06-10, 07:24
goldfishhh goldfishhh is offline
Registered User
 
Join Date: Nov 2004
Posts: 54
INSERT into <blah> VALUES <blah> - Umm...

I've been up all night and am overlooking something so simple I know when I see what I was doing I'm going to laugh. But for now, I plead for help.

I'm doing a rather large INSERT which looks like this:

Code:
INSERT INTO TOTDB01.TST_SUC
	(STRT_DT_DT, STRT_TM_DT, JOB_TXT, TST_SUC_ID)
VALUES
	(DATE('2010-06-03-00.00.04.000000'),DATE('2010-06-03-00.00.04.000000'), 'OPTDARTI', 2000007),
	(DATE('2010-06-03-00.00.04.000000'),DATE('2010-06-03-00.00.04.000000'), 'OPTDARTI', 2000008),
	(DATE('2010-06-03-00.00.04.000000'),DATE('2010-06-03-00.00.04.000000'), 'OPTDARTI', 2000009),
	(DATE('2010-06-03-00.00.04.000000'),DATE('2010-06-03-00.00.04.000000'), 'OPTDARTI', 2000010),
	(DATE('2010-06-03-00.00.04.000000'),DATE('2010-06-03-00.00.04.000000'), 'OPTDARTI', 2000011),
.
.
.
(keeps going for 25,000 or so rows)
.
.
.
(DATE('2010-06-03-00.00.04.000000'),DATE('2010-06-03-00.00.04.000000'), 'OPTDARTI', 2025011);

COMMIT;
The Db is yelling at me for an illegal symbol. Looking at the docs, I'm pretty sure I have the format correct by following
How to INSERT with VALUES.

---------+---------+---------+---------+---------+---------+---------+---------+
DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL ",". SOME SYMBOLS THAT MIGHT
BE LEGAL ARE: MICROSECONDS MICROSECOND SECONDS SECOND MINUTES MINUTE
HOURS
DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNHPARS SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 3 0 0 -1 166 502 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'00000003' X'00000000' X'00000000' X'FFFFFFFF'
X'000000A6' X'000001F6' SQL DIAGNOSTIC INFORMATION
---------+---------+---------+---------+---------+---------+---------+---------+

This does work

Code:
INSERT INTO TOTDB01.TST_SUC
	(STRT_DT_DT, STRT_TM_DT, JOB_TXT, TST_SUC_ID)
VALUES
	(DATE('2010-06-03-00.00.04.000000'),DATE('2010-06-03-00.00.04.000000'), 'OPTDARTI', 2000007)

Last edited by goldfishhh; 06-06-10 at 07:30.
Reply With Quote
  #2 (permalink)  
Old 06-06-10, 07:44
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
Multiple rows VALUES clause using the syntax like in your example is supported only on DB2 for LUW and DB2 for iSeries V5R3 or later.

DB2 for z/OS doesn't support it.

Multiple rows VALUES clause on DB2 for z/OS should include host-variable-array.

Last edited by tonkuma; 06-06-10 at 08:23. Reason: Changed from "DB2 for i V6R1" to "DB2 for iSeries V5R3"
Reply With Quote
  #3 (permalink)  
Old 06-06-10, 08:37
goldfishhh goldfishhh is offline
Registered User
 
Join Date: Nov 2004
Posts: 54
Ahh... I'll try something else.

Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On