Subject Re: Triggers
Author Adam
--- In firebird-support@yahoogroups.com, "visakan13" <visakan13@...>
wrote:
>
> Hi All,
>
> I have just created a Trigger:
>
> CREATE TRIGGER Tri_Area FOR AREA
> BEFORE INSERT
> AS
> BEGIN
> new.SEQ = GEN_ID(AREA_NEXTNO,1);
> END;
>
> When I try to create this trigger through Flame Robin I get the Error:
>
> Preparing query: CREATE TRIGGER Tri_Area FOR AREA
> BEFORE INSERT
> AS
> BEGIN
> new.SEQ = GEN_ID(AREA_NEXTNO,1)
>

1. You may need the word ACTIVE between AREA and BEFORE. (not 100% sure)
2. It looks like FlameRobin is using ; as a SQL command terminator.
Because the trigger is internally needing one, FlameRobin only sees
down to the first ; so it does not see a valid create trigger statement.

Try using

SET TERM ^ ;

CREATE TRIGGER Tri_Area FOR AREA
ACTIVE BEFORE INSERT
AS
BEGIN
new.SEQ = GEN_ID(AREA_NEXTNO,1);
END
^

SET TERM ; ^

Adam