Subject Re: [firebird-support] ISQL & trigger
Author Martijn Tonies
Hello,

> I need a ID (type COUNTER) field in my table, and I discovered that
> with firebird I have to create a generator to achieve the result
> (But why ? isn't counter a SQL92 standard ?? )

"counter"? Nope, that's not a SQL standard.

> Just to try and see what happens, I tried with Mitec IBQuery the
> exaple given in
> http://firebird.sourceforge.net/manual/migration-mssql-data-types.html
>
> Considering the command was given interactively, i prepended the
> SET TERM !! ; as advised in
> http://www.destructor.de/firebird/storedproc.htm
>
> But after having created the exaple table and the example generator,
> when I try to execute the trigger command here's what happens:
> 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) ;

>END !!
> set term ; !!
>
> What I get is :
> Statement #2:
> Dynamic SQL Error
> SQL error code = -104
> Token unknown - line 5, char 80
> END
>
> Why ? what is wrong ?

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com