List:MaxDB« Previous MessageNext Message »
From:D S Date:September 15 2002 7:54am
Subject:whats wrong with my script ?
View as plain text  
Hi,
I am not sure if this is a known issue or not. I have 3 tables, 
and two tables have foreign key references to the first table.
If I insert a row in the first table, I cant delete it anymore 
even if there is no foreign key constraint on that row. Please 
let me know I am doing wrong !

Thanks and regards,
~dil

CREATE TABLE TABLE_A
(
	COL1	INTEGER					
	CONSTRAINT TABLE_A_PK     PRIMARY KEY,
	COL2	VARCHAR(32)		NOT NULL
	CONSTRAINT TABLE_A_UQ     UNIQUE
)
//

CREATE TABLE TABLE_B
(
	COL2	VARCHAR(32)				
	CONSTRAINT TABLE_B_FK REFERENCES TABLE_A(COL2)
)
//

CREATE TABLE TABLE_C
(
	COL1	INTEGER			NOT NULL
	CONSTRAINT TABLE_C_FK REFERENCES  TABLE_A(COL1)
)
//


INSERT INTO TABLE_A VALUES (1, 'Default')
//

-- this statement doesnt work
DELETE FROM TABLE_A
//





-- these statements work
CREATE TABLE TABLE_D
(
	COL1	INTEGER					
	CONSTRAINT TABLE_A_PK     PRIMARY KEY,
	COL2	VARCHAR(32)		NOT NULL
	CONSTRAINT TABLE_A_UQ     UNIQUE
)
//
INSERT INTO TABLE_D VALUES (1, 'Default')
//
DELETE FROM TABLE_D
//



________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag

Thread
whats wrong with my script ?D S15 Sep
  • Re: whats wrong with my script ?Thomas Markus16 Sep