Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Constraint Name?
Wed, Oct 30 2019 12:39 AMPermanent Link

Ian Branch

Avatar

Hi Team,
The good book says..
"EDB_ERROR_CONSTRAINT - The constraint <ConstrainName> has been violated (<ErrorMessage>)This error is raised when a constraint that has been defined for a table is violated. This includes primary key, unique key, foreign key, and check constraints. The specific error message is indicated within the parentheses."
How can/do I pick out the ConstrainName please?   Hmm.  Should it actually be ConstraintName?

Regards & TIA,
Ian
Fri, Nov 8 2019 10:06 AMPermanent Link

Adam Brett

Orixa Systems

Ian,

>>How can/do I pick out the ConstrainName please?   Hmm.  Should it actually be ConstraintName?

When a Constraint is defined in a table, you give it a name. This name is reported when the error occurs. And yes there is a typo in the Help file!

ie

CREATE TABLE "MyTable"
(
"ID" INTEGER DEFAULT UID() NOT NULL,
"DateDone" DATE DEFAULT Current_Date NOT NULL,
"Name" VARCHAR(250),
"StatusID" INTEGER,
"InitialMemo" CLOB COLLATE "ANSI" NOT NULL,
"ResponseMemo" CLOB COLLATE "ANSI",
"DateCreated" TIMESTAMP DEFAULT Current_TimeStamp,
CONSTRAINT "PrimaryKey" PRIMARY KEY ("ID"),
CONSTRAINT "StatusID" FOREIGN KEY ("StatusID")
 REFERENCES "Status" ("ID")
)

In the above table, if there was a Constraint error the name reported would either be "StatusID" or "PrimaryKey".

Adam
Fri, Nov 8 2019 4:10 PMPermanent Link

Ian Branch

Avatar

Thanks Adam.  I shall have a play.
Ian
Image