Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Insert - integrity constraint violation

Re: Insert - integrity constraint violation

From: <jeanch_at_my-deja.com>
Date: 2000/02/29
Message-ID: <89gd8p$kjn$1@nnrp1.deja.com>#1/1

In article <38B3FE04.B73D597B_at_edcmail.cr.usgs.gov>,   Brian Peasland <peasland_at_edcmail.cr.usgs.gov> wrote:
> The parent table does not have the value for the foreign key. Oracle
> does not support cascading inserts. But some people have developed
 tools
> to help do this. I know that Tom Kyte's site has a version of this
> (http://osi.oracle.com/~tkyte/) if you are interested.
>
> HTH,
> Brian
>
> ZC wrote:
> >
> > Need help,
> >
> > I have two tables. When I do an insert into table A, I get a message
> > stating: integrity constraint (DATBASE1.A_FK_B) violated - parent
 key
> > not found. Anyone know what I'm doing wrong that prevents me from
> > entering the data into the table? The referenceor, referencee column
> > are suposed to have the same type of data.
> >
> > I was thinking of some type of cascade insert, but I'm not sure
 oracle
> > supports a cascade insert.
> >
> > Thanks for your input
> > ZC
> >
> > A
> > -----
> > column1 NUMBER NOT NULL,
> > column2 VARCHAR2(20) NOT NULL,
> > column3 VARCHAR2(20) NULL,
> > column4 VARCHAR2(20) NULL
> >
> > B
> > -----
> > columnA NUMBER NOT NULL,
> > columnB VARCHAR2(20) NOT NULL,
> >
> > ALTER TABLE A
> > ADD (CONSTRAINT A_pk
> > PRIMARY KEY (column1));
> > ALTER TABLE B
> > ADD (CONSTRAINT B_pk
> > PRIMARY KEY (columnA));
> >
> > ALTER TABLE A
> > ADD (CONSTRAINT
> > A_fk_B
> > FOREIGN KEY (column4)
> > REFERENCES B);
> >
> > --
> > Someone pass a cork to plug the hole in my head
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> --
> ========================================
> Brian Peasland
> Raytheons Systems at
> USGS EROS Data Center
> These opinions are my own and do not
> necessarily reflect the opinions of my
> company!
> ========================================
> If you're usig oracle 80. and above try using integretry
constraint check deferred until commit time; alter table tab1
add constraint const foriegn key
(column1, column2)
INITIALLY DEFERRED DEFERRABLE; Also have a look at the command SET CONSSTRAINt ALL DEFERRED;

Good luck
JC

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Feb 29 2000 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US