Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 11:39 AM
yoyo
Guest
 
Posts: n/a
Default Delay a trigger

Is there anyway to delay a trigger from firing for a few seconds?

I have an after insert trigger on table1, which selects information from
table2 and table3. Obviously it cannot fire unless the required rows in
table2 and 3 are filled out first. I can't just put the trigger on
table2 or 3, because the order of insert there is different, depending
on how the applicaiton is used, plus it would make for a very
complicated trigger goig that way.
Basically in the application, the user picks something, in the database
in either does insert tab1, insert tab2, insert tab3, or if he does
something else, insert tab1, insert tab3 insert tab2.

So the intent is to just delay an after trigger on tab1 from firing for
a few seconds to allow tab2 and 3 to get filled out. I don't think it's
possible,any suggestions? Timing isn't critical for what the trigger
does, it is critical not to hang the application though.

Thanks

Ken
  #2  
Old November 12th, 2005, 11:39 AM
Brian Tkatch
Guest
 
Posts: n/a
Default Re: Delay a trigger

>I can't just put the trigger on table2 or 3, because the order of insert there is different

Make two TRIGGERs, one for 2 and another for 3, just check for the
record in the other TABLE in order to do anything.

  #3  
Old November 12th, 2005, 11:40 AM
Chris
Guest
 
Posts: n/a
Default Re: Delay a trigger

Not sure how to delay the trigger, but you could dely your trigger
logic after it fired by iterating through a whileloop doing time
calculations compares. Then run your other logic after the loop
finishes. This is an old way of programming time delays

HTH

Chris

  #4  
Old November 12th, 2005, 11:40 AM
yoyo
Guest
 
Posts: n/a
Default Re: Delay a trigger

Chris wrote:[color=blue]
> Not sure how to delay the trigger, but you could dely your trigger
> logic after it fired by iterating through a whileloop doing time
> calculations compares. Then run your other logic after the loop
> finishes. This is an old way of programming time delays
>
> HTH
>
> Chris
>[/color]
The problem with that is it hangs the real insert on tab1 to wait for it
to finish, any time looping for the trigger on tab1, essentially hangs
the insert on tab1, and hence the application waiting for that insert to
finish.
I used 2 triggers like the other person said, with conditional clauses.
The problem I have, is the next trigger I need to make involves
selecting data from 12 tables, not 2, and the order is different
depending on what buttons in the app are being picked. I really don't
want to create 12 triggers with conditional clauses.
Still looking for additional suggestions, thanks for the replies so far!

Ken
  #5  
Old November 12th, 2005, 11:40 AM
Larry
Guest
 
Posts: n/a
Default Re: Delay a trigger

I suggest doing this logic in the application language, not using a
trigger.

  #6  
Old November 12th, 2005, 11:40 AM
yoyo
Guest
 
Posts: n/a
Default Re: Delay a trigger

Larry wrote:[color=blue]
> I suggest doing this logic in the application language, not using a
> trigger.
>[/color]
No access to it. Closed source.
  #7  
Old November 12th, 2005, 11:40 AM
Serge Rielau
Guest
 
Posts: n/a
Default Re: Delay a trigger

yoyo wrote:[color=blue]
> Larry wrote:
>[color=green]
>> I suggest doing this logic in the application language, not using a
>> trigger.
>>[/color]
> No access to it. Closed source.[/color]
Use an intermendiate table which is timestamped.
Then do the real work with another connection. Basically you woudl be
using a queue.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
  #8  
Old November 12th, 2005, 11:40 AM
Brian Tkatch
Guest
 
Posts: n/a
Default Re: Delay a trigger

If a TRIGGER can CALL another PROCEDURE, have a PROCEDURE do all the
logic. Add a TRIGGER to each of the twelve TABLEs to CALL the PROCEDURE
with it's own name

B.

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.