|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problems with "Delete" statement in SQL
Hi,
I have the table: R1(A, B, C) Primary Key (A, B) Foreign Key (A) I'm trying to delete a row using the query: delete from R1 where A = 123; However, Oracle freezes on me. Please help. Thanks. |
|
#2
|
|||
|
|||
|
Primary and foreign keys are defined the parent/child relationship, you cannot delete a record from parent table until it has record in child table. I think your parent table R1 has any child record that's why oracle does not allow to delete this parent record because oracle respects the parent/child relationship. For your future reference you should define keyword ON DELETE CASCADE with your primary key, this key implicitly delete the child records when you try to delete parent record. But this time delete the associative child record of this primary key from the child table then delete it from parent table.
Regards |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Problems with "Delete" statement in SQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|