Problem with referential constraint

"Hübschen, Peter" <[email protected]>
Newsgroups gmane.comp.db.sapdb.general
Message-ID <5037282E0DC5D711974C00304852417A025E60@SERVER-XCH>
Hello, 

I was running into this problem earlier, but now I need an explanation,
cause it's important for project. Earlier I only deleted the referential
constraint. 
My tables are defined:
CREATE TABLE "TBL_RUECKMELDUNG"
(
	"LFD_RUECKFRAGENUMMER"               Integer    NOT NULL    DEFAULT
SERIAL (1),
	"RUECKMELDEDATUM"               Timestamp    DEFAULT TIMESTAMP,
	"LFD_ANFRAGENUMMER"               Integer,
	.....
	PRIMARY KEY ("LFD_RUECKFRAGENUMMER"),
	FOREIGN KEY "REF_RUECK_STAFFEL"	("LFD_ANFRAGENUMMER") REFERENCES 
	"TBL_STAFFELRUECKM" ("LFD_STAFFELNR") ON DELETE  CASCADE
)

CREATE TABLE "TBL_STAFFELRUECKM"
(
	"LFD_RUECKFRAGENUMMER"               Integer    NOT NULL,
            .....
	"LFD_STAFFELNR"               Fixed (10,0)    NOT NULL    DEFAULT
SERIAL (1),
	PRIMARY KEY ("LFD_STAFFELNR")
)


If I try to insert a new line into TBL_RUECKMELDUNG (through SQL-Studio
(latest Version)) I get an integrity constraint violation. If I insert a new
line into TBL_STAFFELRUECKM it works. 
My intention is:
TBL_RUECKMELDUNG contains one line and TBL_STAFFELRUECKM contains one or
more lines which are "linked" to the one line in TBL_RUECKMELDUNG. If I
delete this one line in TBL_RUECKMELDUNG I want to delete the "linked" lines
in TBL_STAFFELRUECKM
So I made the constraint TBL_RUECKMELDUNG -> TBL_STAFFELRUECKM. But after my
experience from below it seems that I have to make a constraint
TBL_STAFFELRUECKM -> TBL_RUECKMELDUNG. Is this right?
I have to fill my first table first, since it contains the main data and the
second one contains more 'detailed' data or maybe no data for that record in
TBL_RUECKMELDUNG.

I ran into the same problem (integrity constraint violation), as I tried to
execute the whole creation script of the database from the docs, which is
archived under
http://listserv.sap.com/pipermail/sapdb.general/2000-November/022897.html

I nearly forgot: I'm using a Redhat 9 box with SAPDB 7.4.3.25

Thanks in advance
Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.