Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 4 of 4 total |
Change a Trigger?? |
Mon, Nov 1 2021 1:36 AM | Permanent Link |
Ian Branch | Hi Team,
I have the following trigger in my Database.. {sql} BEGIN IF OLDROW.JobStatus <> NEWROW.JobStatus THEN SET NEWROW.DateStatusChanged = CURRENT_DATE; END IF; END {sql} This is a Before Update Trigger. I need this now to perform the action on After Update Trigger. Can I do this? If so, how please? Regards & TIA, Ian |
Mon, Nov 1 2021 3:57 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Ian
I'm sure someone much cleverer than me will have a way but I would advise against doing what you ask. Firstly I'm not sure why you would want to do it and secondly, unless I'm wrong (very possible) you would be heading for a disaster: 1. someone updates the record and hist post 2. your after update trigger fires and alters the record 3. you now have an altered record so goto 2 4.woops never get here Is something else changing JobStatus? If not the before update (read before post) is the right place for the trigger, if not you haven't given enough information to say where it should be Roy Lambert |
Mon, Nov 1 2021 5:45 AM | Permanent Link |
Ian Branch | Hi Roy,
The Job Status is changed by any one of 3 or 4 different Apps. Contention is extremely unlikely as the work is streamed, one action after another.. The Before Update Trigger is to save me having to duplicate code in all the Apps to achieve the same thing. Unfortunately I think the Before Update trigger is triggering, pun intended, my Logging routine in the Apps. Anyway, I was just curious if it could be done. Regards, Ian |
Mon, Nov 1 2021 8:25 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Ian
>The Job Status is changed by any one of 3 or 4 different Apps. Contention is extremely unlikely as the work is streamed, one action after another.. >The Before Update Trigger is to save me having to duplicate code in all the Apps to achieve the same thing. Good thinking, and exactly what its for. >Unfortunately I think the Before Update trigger is triggering, pun intended, my Logging routine in the Apps. If that's all the code is then I don't see how it can be triggering a different routine, unless that is triggered somewhere by a change in DateStatusChanged or JobStatus >Anyway, I was just curious if it could be done. and now you know <giggle> Roy |
This web page was last updated on Friday, April 19, 2024 at 07:09 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |