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

Home -> Community -> Usenet -> comp.databases.oracle -> Re: Trigger to delete record from one table with check on another table.

Re: Trigger to delete record from one table with check on another table.

From: Kenneth Osenbroch <kenneth.osenbroch_at_telenor.com>
Date: 3 Jun 2004 02:12:10 -0700
Message-ID: <ce7df6a2.0406030112.2b7f3e5b@posting.google.com>


ed.prochak_at_magicinterface.com (Ed prochak) wrote in message news:<4b5394b2.0405260843.2029300c_at_posting.google.com>...
> kenneth.osenbroch_at_telenor.com (Kenneth Osenbroch) wrote in message news:<ce7df6a2.0405260105.55c4489_at_posting.google.com>...
> > Hi. I want to create a trigger that only allows delete from table A if
> > corresponding record in table B does not exist. Any idea on how this
> > can be done? Thanks, Kenneth.
>
> Sounds more like you want a reference constraint.
> Do you have Primary keys and Foreign Keys set up on the corredsponding
> tables? Looks like from the description table A is the parent table
> (wiht a primary key) and table B is the child table (with a foreign
> key that references the primary key of table A)
>
> HTH,
> ed

Hi, and thanks for your reply.

The thing is that it is not possible to use constraints based on PK's and FK's in this database (the relations are placed on the applicaton layer - hence it doesn't exist any PK's or FK's).

So: I figure trigger is the only solution to ensure the above scenario. Any ideas on how the trigger would look?

Thanks,
Kenneth Received on Thu Jun 03 2004 - 04:12:10 CDT

Original text of this message

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