Subject | ISQL & trigger |
---|---|
Author | giulfin2002 |
Post date | 2004-10-04T00:01Z |
Hi !
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 ?? )
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) 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 ?
Giuliano
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 ?? )
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) 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 ?
Giuliano