Subject Re: [firebird-support] ISQL & trigger
Author Helen Borrie
At 09:32 AM 4/10/2004 +0200, you wrote:

> --- giuliano lotta <giulfin2002@...> ha scritto:
>
>
>---------------------------------
>
> > SET TERM !! ;
> > CREATE TRIGGER my_before_trigger FOR my_table
> > BEFORE INSERT
> > AS
> > BEGIN IF (NEW.my_number IS NULL) THEN NEW.my_number
>=
> > GEN_ID(my_generator, 1)
>
>GEN_ID(my_generator, 1) ;
>
>... and I think the command terminator in this
>particular case should be
>
>GEN_ID(my_generator, 1) !!
>
>But even with this, ... no hope :
>
>Statement #2:
>Dynamic SQL Error
>SQL error code = -104
>Unexpected end of command

First you said you were using isql; next, you said you were using an
interactive statement processor. Which is it?

The sample you supplied originally (with the missing SEMI-COLON terminator
on the statement within the trigger defnition was a script, i.e. multiple
statements.

Be assured, you need the semi-colon as the terminator for statements inside
stored procedure definitions. PSQL statements inside a trigger or
procedure definition MUST use semi-colon terminators.

The purpose of SET TERM is to set an alternative terminator for the CREATE
TRIGGER statement (and for any other DDL statements in the script). When
you are done with defining a PSQL module, you can change the regular
statement terminator back to semicolon if you want to, using another SET
TERM statement.

Search with google for LANGREF.PDF - this is the IB 6 Language Reference
manual. It seems you need it.

./heLen