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
Karma: 0

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: 65153
Registered: March 2007
Location: Nanterre, France, http://...
Karma: 0
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: How to reduce the column length (alternative way) ?
Next Topic: What is Global Temporary Table?
Goto Forum:

Current Time: Tue Aug 22 10:00:26 CDT 2017

Total time taken to generate the page: 0.10018 seconds