Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Location
    India,Mumbai
    Posts
    34

    Unanswered: Compound SQL not working

    Hi,
    I am trying below script(Compund SQL), which is giving me result as "0 rows affected."

    BEGIN ATOMIC
    DECLARE var1 TIMESTAMP;
    SET VAR1 = CURRENT_TIMESTAMP;
    SELECT var1 from sysibm.sysdummy1;
    END



    If I try above script without ATOMIC keyword then it gives error which is as follows.


    "
    [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "END-OF-STATEMENT" was found following "CLARE var1 TIMESTAMP". Expected tokens may include: "<psm_semicolon>". LINE NUMBER=1. SQLSTATE=42601
    (42601,-104)
    [IBM][CLI Driver][DB2/LINUXX8664] SQL0206N "VAR1" is not valid in the context where it is used. SQLSTATE=42703
    (42S22,-206)
    [IBM][CLI Driver][DB2/LINUXX8664] SQL0206N "VAR1" is not valid in the context where it is used. SQLSTATE=42703
    (42S22,-206)
    [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "END-OF-STATEMENT" was found following "END". Expected tokens may include: "JOIN <joined_table>". SQLSTATE=42601
    (42601,-104)
    "

    Just an FYI, we are using Emarcadero Rapid sql tool as an sql editor.
    Can anyone please help me out as I am trying to develop big script.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    the first problem to look at is the terminator
    the ; is being used as terminator - which is not correct
    there should be another character indicating the end of procedure ..
    see doc for terminator
    this can be set in any tool
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Feb 2012
    Location
    India,Mumbai
    Posts
    34
    Thanks for the reply.
    Can you please elaborate more on this or can you please explain by modifying the example that I have provided?

  4. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    the sun comes up for free (sometimes)
    we can point you to the doc where they explain how/what todo
    I don not have the intention todo your job..
    at least have a look at the doc and ask question s if not clear
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

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