Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Problems with Delete statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-03, 03:15
VB_Oracle VB_Oracle is offline
Registered User
 
Join Date: Nov 2003
Posts: 22
Problems with Delete statement

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.
Reply With Quote
  #2 (permalink)  
Old 12-03-03, 03:42
r123456 r123456 is offline
Registered User
 
Join Date: Sep 2003
Location: The extremely Royal borough of Kensington, London
Posts: 778
A foreign key must reference the entire primary key or unique set of columns, thus foreign key (A) in your below table must indicate that (A) refers to a column in another table that i'll call R.

R(A) primary key (A)
R1 (A, B, C) primary key (A, B)
foreign key (A) references R(A)

By default deleting the value of A will have no effect, as A in this case is a child. An error would arise if the primary key of R1 was reference as a foreign key elsewhere as A is part of the parent key.

However given the above simple relations,

delete from R1 where a = x produces no error.

Thus, the problem is not constraint related with default constraint options.
__________________
Bessie Braddock: Winston, you are drunk!
Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

Last edited by r123456 : 12-03-03 at 03:56.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On