Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2008
    Location
    Toronto,Canada
    Posts
    655

    Unanswered: Return immediately !!

    Hi Everyone,

    While I was writig TRIGGER at my job - I needed to return without doing anything. Just as the functions return with RETURN. Can some one help me with the statement to return. or NULL statement.

    If <condition> then

    do nothing ; --- (RETURN) here don't even go further
    else
    do something;
    end if

    I am simply writing just to explain but at workplace the developer had written it thisway conditions were multiple and negetion was quite difficult.
    I told them to do otherway but they insisted. As trigger works fine I did not insist.

    Please advise me proper DB2 statement to return.


    Thanks
    DBFinder

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Try the LEAVE statement.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    I don't see what would be difficult with negating the condition. How about:
    Code:
    IF NOT ( <condition> ) THEN
       -- do something
    END IF;
    Alternatively, you could put an empty BEGIN END block in the then-branch. But that is just cluttering the trigger and unprofessional bad practice (harder to maintain).
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  4. #4
    Join Date
    Sep 2008
    Location
    Toronto,Canada
    Posts
    655
    Good,

    Thanks to both of you.

    DBFinder

Posting Permissions

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