Subject Re: [Firebird-Java] Okay, I'm frazzled
Author Steven Jardine
I think you probably need to change the terminator
try this:

SET TERM ^ ;
CREATE TRIGGER Create_Policy_Set_ID FOR Policy_Set
BEFORE INSERT
AS
BEGIN
NEW.policy_set_id = GEN_ID (POLICY_SET_GENERATOR, 1);
END^
SET TERM ; ^



paulbramble wrote:

>I'm having more fun than anyone should ever have trying to create an
>auto-incrementing trigger.
>
>I have defined the following generator:
>
>show generators;
>Generator POLICY_SET_GENERATOR, current value is 500
>
>
>and table:
>SQL> show table policy_set;
>SYS_ID INTEGER Not Null
>POLICY_SET_ID INTEGER Not Null
>POLICY_SET_TYPE INTEGER Not Null
>POLICY_ID INTEGER Nullable
>POLICY_NAME VARCHAR(30) Nullable
>POLICY_VERSION VARCHAR(30) Nullable
>POLICY_TYPE_ID INTEGER Nullable
>POLICY_GROUP_ID INTEGER Nullable
>POLICY_STATUS VARCHAR(7) Nullable
>POLICY_DATE TIMESTAMP Nullable
>CONSTRAINT INTEG_192:
> Primary key (SYS_ID, POLICY_SET_ID)
>
>
>But when I try:
>
>CREATE TRIGGER Create_Policy_Set_ID FOR Policy_Set
>BEFORE INSERT
>AS
>BEGIN
> NEW.policy_set_id = GEN_ID (POLICY_SET_GENERATOR, 1);
>END;
>
>I get:
>Statement failed, SQLCODE = -104
>
>Dynamic SQL Error
>-SQL error code = -104
>-Token unknown - line 1, char 1
>-END
>
>Any pointers would be appreciated.
>
>Paul
>
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>