Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Unanswered: Problems with Delete statement


    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. #2
    Join Date
    Sep 2003
    The extremely Royal borough of Kensington, London
    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.
    Last edited by r123456; 12-03-03 at 03:56.
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts