Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 7 of 7 total |
How to juse "call" in a trigger? |
Fri, Mar 7 2008 11:29 AM | Permanent Link |
"Uli Becker" | I am learning how to use triggers now. In the manual I found this sample:
-- SendMail procedure with which group to -- send the email to along with the new -- value of the Notes column for the customer -- being updated CREATE TRIGGER "NotesUpdate" AFTER UPDATE OF "Notes" ON "Customer" BEGIN CALL SendEmail('CustomerReps',NEWROW.Notes); END I don't understand the type of the SendMail procedure. Where and how have I to define it? Thanks. Uli |
Mon, Mar 10 2008 3:51 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Uli,
<< I don't understand the type of the SendMail procedure. Where and how have I to define it? >> You would just define it as a stored procedure in the same database. Then you can CALL it from any other function, stored procedure, or trigger. -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Mar 10 2008 4:20 PM | Permanent Link |
Uli Becker | Tim,
> > You would just define it as a stored procedure in the same database. Then > you can CALL it from any other function, stored procedure, or trigger. > I am sorry - I don't understand that: I cannot place any code in a stored procedure: so: how does the SendMail-procedure e.g. look like? Uli |
Tue, Mar 11 2008 4:42 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Uli,
<< I am sorry - I don't understand that: I cannot place any code in a stored procedure: so: how does the SendMail-procedure e.g. look like? >> You can define a stored procedure as external: http://www.elevatesoft.com/scripts/manual.dll?action=mantopic&id=edb1sql&category=10&topic=162 The EXTERNAL NAME clause specifies that you want to use an external module instead of an SQL/PSM body, and the name is the same as an existing external module: http://www.elevatesoft.com/scripts/manual.dll?action=mantopic&id=edb1sql&category=0&topic=13 You can create an external module very easily by doing the following in Delphi 5: File/New Select the ElevateDB tab Double-click on the ElevateDB External Module icon This will generate an empty template application for creating an external module that can contain any number of external procedures, including something like the SendMail procedure. And, this is all native Delphi code instead of SQL/PSM, which is ideal for situations where you need to interface with external hardware or libraries. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Mar 11 2008 5:26 PM | Permanent Link |
Uli Becker | Tim,
<< You can define a stored procedure as external: http://www.elevatesoft.com/scripts/manual.dll?action=mantopic&id=edb1sql&category=10&topic=162 >> Thank you. That sounds great! I'll check that tomorrow. Regards Uli |
Wed, Mar 12 2008 3:54 AM | Permanent Link |
Uli Becker | Tim,
I created a small "Hello World" dll and a Stored Procedure that calls this dll. That works fine and is tested by executing the SP. Now I created a trigger like this: EXECUTE IMMEDIATE 'CREATE TRIGGER "PatientenUpdate" AFTER UPDATE OF "Name" ON "Patienten" BEGIN CALL ExecuteMyDLL; END '; The Column Name in the table Patienten should be handled on any changes. Unfortunately there doesn't happen anything when changing the value of Name. Did I miss anything? Uli |
Wed, Mar 12 2008 3:34 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Uli,
<< The Column Name in the table Patienten should be handled on any changes. Unfortunately there doesn't happen anything when changing the value of Name. Did I miss anything? >> No, it's a bug. The issue is that the modification flag for the column is getting reset prior to the AfterUpdate trigger being executed. IOW, it will work if you define the trigger as a *before* update trigger. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Sunday, May 5, 2024 at 07:30 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |