Subject Re: [firebird-support] Re: Triggers
Author Helen Borrie
At 11:17 PM 18/04/2007, you wrote:
>Thank you all the input,
>
>Helen as per your advice I tried with the SET TRIM, I get

Nope, that was Adam's advice. My advice was NOT to use SET
TERM. But Nando (who is one of the developers of FlameRobin) said
FlameRobin would accept it (in a script, of course).


>Starting transaction...
>Preparing query: >SET TERM ^
>*** IBPP::SQLException ***
>Context: Statement::Prepare( >SET TERM ^ )
>Message: isc_dsql_prepare failed
>
>SQL Message : -104
>Invalid token
>
>Engine Code : 335544569
>Engine Message :
>Dynamic SQL Error
>SQL error code = -104
>Token unknown - line 1, column 1

That is because SET TERM is not a dynamic SQL statement.

>Execute time: 00:00:01.
>
>Martijn as per your advice I get:
>
>Preparing query:
>
>CREATE TRIGGER Tri_Area FOR AREA
>ACTIVE BEFORE INSERT
>AS
>BEGIN
>new.SEQ = GEN_ID(AREA_ NEXTNO,1);
>END
>
>
>*** IBPP::SQLException ***
>Context: Statement::Prepare(
>
>CREATE TRIGGER Tri_Area FOR AREA
>ACTIVE BEFORE INSERT
>AS
>BEGIN
>new.SEQ = GEN_ID(AREA_ NEXTNO,1);
>END
> )
>Message: isc_dsql_prepare failed
>
>SQL Message : -104
>Invalid token
>
>Engine Code : 335544569
>Engine Message :
>Dynamic SQL Error
>SQL error code = -104
>Token unknown - line 7, column 24
>NEXTNO

That is because you have a space before NEXTNO. So AREA_NEXTNO is a
legal identifier, while AREA_ NEXTNO is not.

>I tried this sample in SQL Hammer I didn't get any error.

You probably typed it correctly in SQLHammer. :-)

./heLen