Subject RE: [firebird-support] This trigger
Author Bogdan
SET TERM ^ ;
CREATE TRIGGER HALL_ALL_NAMA ACTIVE
BEFORE INSERT POSITION 0
AS
BEGIN
SELECT nama FROM pool WHERE matric = NEW.matric
INTO NEW.NAMA;
END^
SET TERM ; ^

> -----Original Message-----
> From: firebird-support@yahoogroups.com [mailto:firebird-
> support@yahoogroups.com] On Behalf Of ShepherdHill DB Subscriptions
> Sent: Tuesday, July 04, 2006 10:42 AM
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] This trigger
>
> Hi,
>
> What am I doing wrong here?
>
> ----
> SET TERM ^ ;
> CREATE TRIGGER HALL_ALL_NAMA ACTIVE
> BEFORE INSERT POSITION 0
> AS
> BEGIN
> NEW.nama = (SELECT nama FROM pool WHERE matric = NEW.matric);
> END^
> SET TERM ; ^
> ----
>
> Tables Structures:
> ----
> CREATE TABLE POOL(
> DEPT Varchar(3) NOT NULL COLLATE NONE,
> MATRIC Varchar(9) NOT NULL COLLATE NONE,
> NAMA Varchar(60) NOT NULL COLLATE NONE,
> LEVELL Varchar(1) NOT NULL COLLATE NONE,
> ALL_VAL D_BOOLEAN DEFAULT 0 NOT NULL,
> CONSTRAINT PK_POOL_1 PRIMARY KEY (MATRIC)
> );
>
> CREATE TABLE HALL_ALLOCATION(
> HALL Varchar(2) NOT NULL COLLATE NONE,
> MATRIC Varchar(9) NOT NULL COLLATE NONE,
> NAMA Varchar(60) NOT NULL COLLATE NONE,
> SESSION Varchar(9) NOT NULL COLLATE NONE,
> ALLOCATION Varchar(14) NOT NULL COLLATE NONE,
> REMARK Varchar(100) COLLATE NONE,
> ALL_VAL D_BOOLEAN DEFAULT 0 NOT NULL,
> CONSTRAINT PK_HALL_ALLOCATION_1 PRIMARY KEY (MATRIC,SESSION)
> );
>
>
> Error Message:
> ----
> SQL Message : -206
> Column does not belong to referenced table
>
> Engine Code : 335544569
> Engine Message :
> Dynamic SQL Error
> SQL error code = -206
> Subselect illegal in this context
>
> Tested on version 1.5.3 and 2.0 RC2.
>
> Regards.
>
>
>
> Chris.
>
>
>
>
>
> ___________________________________________________________
> All new Yahoo! Mail "The new Interface is stunning in its simplicity and
> ease of use." - PC Magazine
> http://uk.docs.yahoo.com/nowyoucan.html
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.9.8/381 - Release Date: 3.7.2006