If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Return immediately !!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-13-08, 15:30
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
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
Reply With Quote
  #2 (permalink)  
Old 11-13-08, 16:29
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Try the LEAVE statement.
Reply With Quote
  #3 (permalink)  
Old 11-13-08, 16:46
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
  #4 (permalink)  
Old 11-13-08, 16:53
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Good,

Thanks to both of you.

DBFinder
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On