Subject RE: [ib-support] Creating a Trigger gives Error Msg: Invalid Column type: 0
Author Alan McDonald
Raymond,
which trigger gives the error,
and can I ask why you set the position of the pk trigger so high?
Alan
-----Original Message-----
From: news@... [mailto:news@...]On Behalf Of Raymond
Kennington
Sent: Friday, 15 November 2002 18:14
To: ib-support@yahoogroups.com
Subject: [ib-support] Creating a Trigger gives Error Msg: Invalid Column
type: 0


Creating a Trigger gives Error Msg: Invalid Column type: 0

Here's the relevant info:

CREATE TABLE Animal
(
ID INTEGER NOT NULL,
Name VARCHAR(20) NOT NULL,
Sex Char(1) NOT NULL,
"Sire ID" INTEGER,
"Dam ID" INTEGER
)

ALTER TABLE Animal ADD CONSTRAINT PK_Animal PRIMARY KEY (ID)

CREATE TRIGGER BI_GEN_ANIMAL_ID FOR ANIMAL
ACTIVE
BEFORE INSERT
POSITION 32767
AS
begin
if (new.ID is NULL) then
new.ID = gen_id(GEN_ANIMAL_ID, 1);
end

CREATE EXCEPTION EX_Sire_DNE 'Sire DNE';
CREATE EXCEPTION EX_Dam_DNE 'Dam DNE';

CREATE TRIGGER BI_CHECK_ANIMAL_SIRE FOR ANIMAL
ACTIVE
BEFORE INSERT
POSITION 1
AS
DECLARE VARIABLE ParentID INTEGER;
DECLARE VARIABLE ParentSex CHAR(1);
begin
if (NEW."Sire ID" IS NOT NULL) then
begin
SELECT ID, Sex FROM Animal WHERE (ID = NEW."Sire ID") INTO :ParentID,
:ParentSex;

if (:ParentID IS NULL) then
begin
EXCEPTION EX_Sire_DNE;
end

if (:ParentSex <> 'M') then
begin
EXCEPTION EX_Sire_Invalid_Sex;
end
end
end

What's the problem?

TIA.
Raymond.
--
Raymond Kennington
Programming Solutions
W2W Team B

To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]