Subject | index unexpectedly deleted |
---|---|
Author | guscottg |
Post date | 2002-01-09T16:09:24Z |
I have created table with the following definition:
/* Table: EVENT_TYPE, Owner: SYSDBA */
CREATE TABLE "EVENT_TYPE"
(
"EVT_EVTID" CHAR(20)NOT NULL,
"EVT_NAME" CHAR(15)NOT NULL,
"EVT_PARENT" CHAR(20),
CONSTRAINT "PK_EVT_EVTID" PRIMARY KEY ("EVT_EVTID")
);
ALTER TABLE "EVENT_TYPE" ADD
CONSTRAINT "CK_EVT_PARENT"
CHECK (Evt_Parent BETWEEN '1' AND '4' or Evt_Parent is null);
I have the following trigger which should check the table to see if
the values which are about to be entered into the columns evt_Id and
evt_parent are unique (can't use a unique constraint as evt_parent
can accept null values).
SET TERM ^ ;
CREATE TRIGGER "EVT_BI" FOR "EVENT_TYPE" ACTIVE BEFORE INSERT
POSITION 0
AS
DECLARE VARIABLE Counter SmallInt;
BEGIN
SELECT COUNT(*) FROM Event_Type
Where Evt_Name=NEW.Evt_Name and Evt_Parent=NEW.Evt_Parent INTO
Counter;
IF (Counter <1)
THEN
IF (NEW.EVT_EVTID IS NULL) THEN
NEW.EVT_EVTID = GEN_ID(GEN_EVT_ID, 1);
ELSE
EXCEPTION Exist_Ex;
END
When I try to insert a value I receive the following error:
"Unsuccessful execution caused by system error that does not preclude
successful execution of subsequent statements.
index unexpectedly deleted."
Can any explain what I have done wrong and how to correct it
/* Table: EVENT_TYPE, Owner: SYSDBA */
CREATE TABLE "EVENT_TYPE"
(
"EVT_EVTID" CHAR(20)NOT NULL,
"EVT_NAME" CHAR(15)NOT NULL,
"EVT_PARENT" CHAR(20),
CONSTRAINT "PK_EVT_EVTID" PRIMARY KEY ("EVT_EVTID")
);
ALTER TABLE "EVENT_TYPE" ADD
CONSTRAINT "CK_EVT_PARENT"
CHECK (Evt_Parent BETWEEN '1' AND '4' or Evt_Parent is null);
I have the following trigger which should check the table to see if
the values which are about to be entered into the columns evt_Id and
evt_parent are unique (can't use a unique constraint as evt_parent
can accept null values).
SET TERM ^ ;
CREATE TRIGGER "EVT_BI" FOR "EVENT_TYPE" ACTIVE BEFORE INSERT
POSITION 0
AS
DECLARE VARIABLE Counter SmallInt;
BEGIN
SELECT COUNT(*) FROM Event_Type
Where Evt_Name=NEW.Evt_Name and Evt_Parent=NEW.Evt_Parent INTO
Counter;
IF (Counter <1)
THEN
IF (NEW.EVT_EVTID IS NULL) THEN
NEW.EVT_EVTID = GEN_ID(GEN_EVT_ID, 1);
ELSE
EXCEPTION Exist_Ex;
END
When I try to insert a value I receive the following error:
"Unsuccessful execution caused by system error that does not preclude
successful execution of subsequent statements.
index unexpectedly deleted."
Can any explain what I have done wrong and how to correct it