Subject | Re: [IBO] Foreign key |
---|---|
Author | Helen Borrie |
Post date | 2001-08-17T09:20:15Z |
At 11:57 AM 17-08-01 +0200, you wrote:
Using doubles for keys is not advisable. There are always precision problems when transporting them to and from Delphi. Links between keys don't work as expected if they don't match exactly. Use integers or numeric(18,0). If you need to have a decimal key then use datatype DECIMAL or NUMERIC.
Regards,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>I have two tables:This is not enough information to determine what kind of exception was raised. What was the error message?
>person_info AND events
>every event MUST hold one from the person_info.
>THIS is what i recive when i do extract :
>
>CREATE TABLE EVENTS (
> EVENT_ID DOUBLE PRECISION NOT NULL,
> PERSON_INFO_ID DOUBLE PRECISION NOT NULL,
> CONSTRAINT EVENTS_PK PRIMARY KEY (EVENT_ID)
>);
>
>/* Table: PERSON_INFO */
>CREATE TABLE PERSON_INFO (
> PERSON_INFO_ID DOUBLE PRECISION NOT NULL,
> CONSTRAINT PERSON_INFO_PK PRIMARY KEY (PERSON_INFO_ID)
>);
>
>ALTER TABLE EVENTS ADD CONSTRAINT "pii" FOREIGN KEY (PERSON_INFO_ID)
>REFERENCES PERSON_INFO(PERSON_INFO_ID);
>
>My problem is when i try to insert data with a value of person_info_id
>to events when there is no such person_info_id i recive error:
>ISC ERROR CODE : 33554466
>.If the constraint were already in place when you attempted that insert, you would have got a constraint violation error regardless. It is the task of the foreign key constraint to PREVENT you from adding a row for which a referenced key does not exist.
>it was before i added the person_info_id constraint to events.
>Could somebody help me?
Using doubles for keys is not advisable. There are always precision problems when transporting them to and from Delphi. Links between keys don't work as expected if they don't match exactly. Use integers or numeric(18,0). If you need to have a decimal key then use datatype DECIMAL or NUMERIC.
Regards,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________