Home » SQL & PL/SQL » SQL & PL/SQL » deleting rows from master and child (Oracle 10g, win XP)
deleting rows from master and child [message #301620] Thu, 21 February 2008 03:18 Go to next message
Messages: 37
Registered: February 2008
Location: pakistan

I have 3 database tables:
department (dep_id, d_name)
employee (emp_id, dep_id)
room (room_id, dep_id)

when i use the query: delete from departmet where d_name = ' comp'
then there is an error: ORA-02292: integrity constraint violated, child record found

I am new to Oracle, please write me the query that will delete the rows from master and child tables of 'comp' department.

Re: deleting rows from master and child [message #301625 is a reply to message #301620] Thu, 21 February 2008 03:27 Go to previous message
Michel Cadot
Messages: 63917
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I am new to Oracle

So why do you post in Expert forum?

3 ways:
- create your constraint with on delete cascade
- create your constraint "deferable" and delete the parent and children in the order you want
- delete the children before deleting the parent.

Previous Topic: merged: PLS-00321 and ORA-00900
Next Topic: What is Global Temporary Table?
Goto Forum:

Current Time: Mon Oct 24 21:05:38 CDT 2016

Total time taken to generate the page: 0.12053 seconds