Subject | Foreign Key and NOT NULL |
---|---|
Author | Uwe Oeder |
Post date | 2003-11-17T13:39:09Z |
When moving data from Paradox tables to firebird. I always get an INTEG_23
constrating error on the following table:
CREATE TABLE Owner /* Wp */
(
OwIDSQ INTEGER NOT NULL ,
CityVBSQ INTEGER NOT NULL ,
OwVBSQ INTEGER ,
OwName VARCHAR(120) NOT NULL ,
PRIMARY KEY (OwIDSQ) ,
FOREIGN KEY (CityVBSQ) REFERENCES City (CityIDSQ) ON DELETE CASCADE ,
FOREIGN KEY (OwVBSQ) REFERENCES Whitepage (OwIDSQ) ON DELETE CASCADE
) ;
OwVBSQ may reference another record in the same table but must not. I gave
OwVBSQ a NOT NULL constraint so it could take NULL values for those records
where this self referencing does not apply. But as soon as I enter a record
where OwVBSQ is NULL I get an error message. What is wrong ?
constrating error on the following table:
CREATE TABLE Owner /* Wp */
(
OwIDSQ INTEGER NOT NULL ,
CityVBSQ INTEGER NOT NULL ,
OwVBSQ INTEGER ,
OwName VARCHAR(120) NOT NULL ,
PRIMARY KEY (OwIDSQ) ,
FOREIGN KEY (CityVBSQ) REFERENCES City (CityIDSQ) ON DELETE CASCADE ,
FOREIGN KEY (OwVBSQ) REFERENCES Whitepage (OwIDSQ) ON DELETE CASCADE
) ;
OwVBSQ may reference another record in the same table but must not. I gave
OwVBSQ a NOT NULL constraint so it could take NULL values for those records
where this self referencing does not apply. But as soon as I enter a record
where OwVBSQ is NULL I get an error message. What is wrong ?