Subject | Problems creating triggers |
---|---|
Author | Richard |
Post date | 2005-03-03T20:50:46Z |
Hi,
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.
Any ides?
Thanks in advance.
Richard Mace
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.
Any ides?
Thanks in advance.
Richard Mace