Subject | Re: [firebird-support] Problems creating triggers |
---|---|
Author | Helen Borrie |
Post date | 2005-03-04T00:36:23Z |
At 08:50 PM 3/03/2005 +0000, Richard Mace wrote:
to define your objects.
There is no field called ID in that table, because you named it "Id".
./hb
>Hi,Ah, you should read the warnings (frequent) about using quoted identifiers
>I have the following code:
>
>CREATE DATABASE '192.168.0.190:/var/lib/firebird2/dbase.fdb' page_size
>8192 user 'SYSDBA' password 'masterkey';
>
>/*CONNECT '192.168.0.190:/var/lib/firebird2/dbase.fdb' user 'SYSDBA'
>password 'masterkey';*/
>
>/*CREATE Departments Table*/
>
>CREATE TABLE "Departments"(
> "Id" INTEGER NOT NULL,
> "Department" VARCHAR(50) NOT NULL,
> "Image16" BLOB,
> "Image32" BLOB,
> PRIMARY KEY ("Id")
> );
>
>/* Create Department GEN_ID */
>
>CREATE GENERATOR GEN_DEPARTMENT_ID;
>COMMIT;
>
>SET TERM ^;
>CREATE TRIGGER Department_Id FOR "Departments"
>ACTIVE BEFORE INSERT POSITION 0
>AS
>BEGIN
> IF ((NEW.ID IS NULL) OR (NEW.Id <=0)) THEN
> NEW.Id = GEN_ID(GEN_DEPARTMENT_ID,1);
>END
>^
>SET TERM ;^
>
>But I am getting an error from isql saying:
>Use CONNECT or CREATE DATABASE to specify a database
>Statement failed, SQLCODE = -206
>
>Dynamic SQL Error
>-SQL error code = -206
>-Column unknown
>-NEW.ID
>-At line 5, column 11.
>Expected end of statement, encountered EOF
>
>I even have Helen Borrie's book now, but I am still stuck.
to define your objects.
There is no field called ID in that table, because you named it "Id".
./hb