Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    16

    Unanswered: Problem when using Begin Atomic/ End to write Function.

    I have created Function f1 and Function f2. f1 is a single-statement one while f2 has a multiple lines.
    --f1
    CREATE FUNCTION f1()
    RETURNS VARCHAR(2)
    SPECIFIC f1
    RETURN 'ok';

    --f2
    CREATE FUNCTION f1()
    RETURNS VARCHAR(2)
    SPECIFIC f2
    BEGIN ATOMIC
    DECLARE v VARCHAR(2);
    set v = 'ok';
    RETURN v;
    END;

    when i run
    db2 -tf filename
    to add those functions,

    adding f1 is ok. but for f2, I always receive an error with error code 42601 saying unexpected character ")" after "DECLARE v VARCHAR(2",
    I am using DB2 8.1.4 FixPack4 on windows platform.

    Anyone has some idea about that problem?
    Thanks.

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

    Re: Problem when using Begin Atomic/ End to write Function.

    CREATE FUNCTION f1()
    RETURNS VARCHAR(2)
    SPECIFIC f1
    RETURN 'ok' @

    --f2
    CREATE FUNCTION f1()
    RETURNS VARCHAR(2)
    SPECIFIC f2
    BEGIN ATOMIC
    DECLARE v VARCHAR(2);
    set v = 'ok';
    RETURN v;
    END @

    db2 -td@ -f filename

    Cheers

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Nov 2003
    Posts
    16
    UNDERSTOOD.

    Thanks a lot.

Posting Permissions

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