Delete record [message #53432] |
Thu, 19 September 2002 06:06 |
lara
Messages: 4 Registered: September 2002
|
Junior Member |
|
|
hi guys,
i want to delete record in parent table. when it have record in child table, deletion of record should not be allowed. Why does oracle allowed me to delete records in parent table while there's still child record exists?
can u help me to trace this?
thanks in advance,
Lara
|
|
|
Re: Delete record [message #53443 is a reply to message #53432] |
Thu, 19 September 2002 19:08 |
Anupam
Messages: 62 Registered: July 2001
|
Member |
|
|
I assume that you already have a foreign ey relationship between the two tables. Chech for the "Cascade" clause for the key.
|
|
|
Re: Delete record [message #53456 is a reply to message #53432] |
Fri, 20 September 2002 11:59 |
sai sreenivas jeedigunta
Messages: 370 Registered: November 2001
|
Senior Member |
|
|
Hello Lara,
No need of any thing else..
If u dont Want to allow parent rec deletion if Child exists ...simply set a Foreign key.
If u want Child to automatically delete when parent rec get deleted ..set the Foriegn key with ON DELETE CASCADE option..
If you want to Have this trace info at some place...I suggest you Write a Befor Trigger on Table / Audit on the Delete command..
Byee
sai
|
|
|