Subject | Re: [firebird-support] ISQL & trigger |
---|---|
Author | Helen Borrie |
Post date | 2004-10-04T00:59:38Z |
At 12:01 AM 4/10/2004 +0000, you wrote:
statement. Should be:
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 ; !!
./heLen
>Hi !No.
>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 theJust a simple syntax error: you omitted the semi-colon at the end of 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 ?
statement. Should be:
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 ; !!
./heLen