Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Posts
    49

    Unanswered: DB2 Command Centre batch execution

    How do I execute a bunch of sql statements from the command centre?
    @ is my statement terminator


    I was doing the following
    begin atomic
    CREATE TABLE test1 (
    col1 int,
    col2 int
    )
    ;
    CREATE TABLE test2 (
    col1 int,
    col2 int
    )
    ;

    end


    and the error I got was

    SQL0104N An unexpected token "test1" was found following
    "atomic
    CREATE TABLE". Expected tokens may include: "<space>
    ".

    Explanation:

    A syntax error in the SQL statement was detected at the specified
    token following the text "<text>". The "<text>" field indicates
    the 20 characters of the SQL statement that preceded the token
    that is not valid.

    As an aid to the programmer, a partial list of valid tokens is
    provided in the SQLERRM field of the SQLCA as "<token-list>".
    This list assumes the statement is correct to that point.

    The statement cannot be processed.

    User Response:

    Examine and correct the statement in the area of the specified
    token.

    sqlcode : -104

    sqlstate : 42601

    Thanks,
    Asha

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: DB2 Command Centre batch execution

    Asha

    I assume that you want a few statements in the same UOW, ie if the n-th statement fails, you want to rollback all statements from the 1 to n and not just N ...

    Well, for this you will have to set AUTOCOMMIT OFF ... You can do this when executing your statements. If you want @ to be the statement delimiter :

    db2 +c -td@ -vf<filename>

    Here +c tells AUTOCOMMIT Off ....

    Remember to include an explicit commit statement at appropriate places in the script ...

    HTH

    Cheers

    sathyaram

  3. #3
    Join Date
    Feb 2003
    Posts
    49

    Re: DB2 Command Centre batch execution

    But I cannot just type

    begin atomic
    CREATE TABLE test1 (
    col1 int,
    col2 int
    )
    ;
    CREATE TABLE test2 (
    col1 int,
    col2 int
    )
    ;

    end

    in the command centre and execute it???

    Thanks
    Asha
    Originally posted by sathyaram_s
    Asha

    I assume that you want a few statements in the same UOW, ie if the n-th statement fails, you want to rollback all statements from the 1 to n and not just N ...

    Well, for this you will have to set AUTOCOMMIT OFF ... You can do this when executing your statements. If you want @ to be the statement delimiter :

    db2 +c -td@ -vf<filename>

    Here +c tells AUTOCOMMIT Off ....

    Remember to include an explicit commit statement at appropriate places in the script ...

    HTH

    Cheers

    sathyaram

  4. #4
    Join Date
    Feb 2003
    Posts
    49

    Re: DB2 Command Centre batch execution

    But I cannot just type

    begin atomic
    CREATE TABLE test1 (
    col1 int,
    col2 int
    )
    ;
    CREATE TABLE test2 (
    col1 int,
    col2 int
    )
    ;

    end

    in the command centre and execute it???

    Thanks
    Asha
    Originally posted by sathyaram_s
    Asha

    I assume that you want a few statements in the same UOW, ie if the n-th statement fails, you want to rollback all statements from the 1 to n and not just N ...

    Well, for this you will have to set AUTOCOMMIT OFF ... You can do this when executing your statements. If you want @ to be the statement delimiter :

    db2 +c -td@ -vf<filename>

    Here +c tells AUTOCOMMIT Off ....

    Remember to include an explicit commit statement at appropriate places in the script ...

    HTH

    Cheers

    sathyaram

Posting Permissions

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