Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    54

    Unanswered: 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 08:30.

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    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 09:23. Reason: Changed from "DB2 for i V6R1" to "DB2 for iSeries V5R3"

  3. #3
    Join Date
    Nov 2004
    Posts
    54
    Ahh... I'll try something else.


Posting Permissions

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