Subject Trigger Help
Author Lee Jenkins
Hello all,

I am using the following trigger to update a value in the "Orders" table
and the "Stations" table in my database. I know that it appears not to
be multi user safe, but rules in the client app prevent any two person
from being logged onto a particular "Station" which provides the
"StationID" field below. The problem is that the trigger does not seem
to be firing.

CREATE TRIGGER INSERTEXTORDERID FOR ORDERS
ACTIVE BEFORE INSERT POSITION 0
AS
DECLARE VARIABLE UseID SmallInt;
DECLARE VARIABLE LastExtOrderID Integer;
BEGIN
Begin
SELECT UseExtOrderID, ExtOrderID
FROM STATIONS
WHERE STationID = NEW.StationID
INTO :UseID, :LastExtOrderID;
If (:UseID = 1) THEN
begin
New.ExtOrderID = :LastExtOrderID + 1;
UPDATE Stations SET Stations.ExtOrderID =


Stations.ExtOrderID + 1 WHERE Stations.StationID = New.StationID;
end
end

END
--

Warm Regards,

Lee