Subject Re: [IBO] Question about TIB_Query
Author Salvatore Besso
Luiz and Svein,

thank you for your answers. They are a good starting point, but I
still have troubles. This is a snippet of the DDL that creates my
database:

----------------------------------------

/* Domains */

CREATE DOMAIN PREFIX_NUMBER AS
SMALLINT
NOT NULL
CHECK (VALUE BETWEEN 1 AND 1000);

CREATE DOMAIN ENTITY_NAME AS
VARCHAR (45)
NOT NULL;

CREATE DOMAIN OTHER_NAMES AS
VARCHAR (100)
DEFAULT NULL;

CREATE DOMAIN CAPITAL_NAME AS
VARCHAR (50)
DEFAULT NULL;

CREATE DOMAIN LOCAL_CAPITAL_NAME AS
VARCHAR (80)
DEFAULT NULL;

CREATE DOMAIN LOGICAL AS
SMALLINT
DEFAULT 0
NOT NULL
CHECK (VALUE IN (0, 1));

CREATE DOMAIN ENTITY_FLAG AS
BLOB
SUB_TYPE 0
SEGMENT SIZE 512
DEFAULT NULL;

/* Tables */

CREATE TABLE PREFIXES (
PREFIX PREFIX_NUMBER,
NAME ENTITY_NAME,
NAME_U ENTITY_NAME,
FORMAL_NAME OTHER_NAMES,
LOCAL_NAME OTHER_NAMES,
LOCAL_FORMAL_NAME OTHER_NAMES,
CAPITAL CAPITAL_NAME,
CAPITAL_U CAPITAL_NAME,
LOCAL_CAPITAL LOCAL_CAPITAL_NAME,
CAPITAL_AWARD LOGICAL,
DELETED LOGICAL,
SMALL_FLAG ENTITY_FLAG,
BIG_FLAG ENTITY_FLAG,

PRIMARY KEY (PREFIX));

/* Indices */

CREATE INDEX IDX_NAMES
ON PREFIXES (NAME_U);

CREATE INDEX IDX_CAPITALS
ON PREFIXES (CAPITAL_U);

CREATE INDEX IDX_CAPITAL_AWARD
ON PREFIXES (CAPITAL_AWARD);

CREATE INDEX IDX_DELETED
ON PREFIXES (DELETED);

/* Triggers */

SET TERM !! ;

CREATE TRIGGER TR_UPPER FOR PREFIXES
ACTIVE BEFORE INSERT
AS
BEGIN
NEW.NAME_U = UPPER (NAME);
NEW.CAPITAL_U = UPPER (CAPITAL);
END !!

SET TERM ; !!

----------------------------------------

When I execute this script I get this error, always located in the
trigger body:

Column does not belong to referenced table.
Dynamic SQL Error. SQL error code = -206.
Column unknown.

I can say that I am using the latest version of IBExpert to excute
this script.

Any help ?

Thank you
Salvatore Besso