Thread: Can anyone see error in my embedded SQL below?

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    115

    Can anyone see error in my embedded SQL below?

    Code:
        208 EXEC SQL DECLARE GLOBAL TEMPORARY TABLE Next_Step
        209     AS
        210     SELECT MIN(pr.step), ms.cin
        211           from psr_coil_mstr ms,msd_mfg_to_mo_lot m,msd_proc_rte pr
        212           where  m.mo=ms.mo
        213                  and m.mo_lot=ms.mo_lot
        214                  and pr.psu_key=m.psu_key
        215                  and ms.next_step_cc=996
        216                  and ms.defunct_flag != 'Y'
        217                  and pr.step>ms.next_step
        218                  and pr.cc != 171
        219                  and pr.cc != 173
        220          group by ms.cin
        221           on commit preserve rows
        222           with norecovery
        223     EXEC SQL COMMIT;
    The error I get is:

    %% Error in file cooling_rpt.sc, Line 208:
    E_EQ0244 Syntax error on 'Next_Step'.

    make: 1254-004 The error code from the last command is 255.

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Does it need to be terminated with a semicolon?
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Todd Burch View Post
    Does it need to be terminated with a semicolon?
    It is on line 223. It attempts to create a temporary table, initializing it with the content of another table.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Quote Originally Posted by matsp View Post
    It is on line 223. It attempts to create a temporary table, initializing it with the content of another table.

    --
    Mats
    Line 223 is a completely different SQL statement. The statement starting on line 208 needs to be terminated (Mine was a rhetorical question - it needs to be terminated)
    Mainframe assembler programmer by trade. C coder when I can.

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    115

    Changed to below and still get error

    Code:
        208  EXEC SQL DECLARE GLOBAL TEMPORARY TABLE
        209     next_cc
        210     AS SELECT min(pr.step), ms.cin
        211           from psr_coil_mstr ms,msd_mfg_to_mo_lot m,msd_proc_rte pr
        212           where  m.mo=ms.mo
        213                  and m.mo_lot=ms.mo_lot
        214                  and pr.psu_key=m.psu_key
        215                  and ms.next_step_cc=996
        216                  and ms.defunct_flag != 'Y'
        217                  and pr.step>ms.next_step
        218                  and pr.cc != 171
        219                  and pr.cc != 173
        220          group by ms.cin
        221           on commit preserve rows
        222           with norecovery;
        223   EXEC SQL COMMIT;
    Any other suggestions?
    Thanks

  6. #6
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Here: http://docs.ingres.com/sqlref/Declar...aryTable#o2982

    The column list specification for the temp table does not appear to be optional.
    Mainframe assembler programmer by trade. C coder when I can.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please help create a loop for embedded SQL
    By cjohnman in forum C Programming
    Replies: 4
    Last Post: 04-24-2008, 06:46 AM
  2. Embedded SQL Order By
    By cjohnman in forum C Programming
    Replies: 12
    Last Post: 04-15-2008, 03:45 PM
  3. Embedded SQL
    By sarac in forum C Programming
    Replies: 1
    Last Post: 05-04-2006, 09:09 AM
  4. Problem with embedded SQL in C/C++ (ECPG)
    By NeuralClone in forum C Programming
    Replies: 4
    Last Post: 10-21-2005, 05:16 PM
  5. Embedded SQL ... should be quick ...
    By MadGooseXP in forum C Programming
    Replies: 3
    Last Post: 11-05-2002, 08:34 PM