delete from <table name> cascade ???????/
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: delete from <table name> cascade ???????/

  1. #1
    Join Date
    Mar 2001
    Location
    New York , New York
    Posts
    577
    Hi,
    I am trying to delete a contacts table using the following command but it gives me an error


    1* delete from contacts cascade where contact_id=56123
    SQL> /
    delete from contacts cascade where contact_id=56123
    *
    ERROR at line 1:
    ORA-02292: integrity constraint (COMPANY.SYS_C0029597) violated - child record
    found


    why doesnt the cascade option work in this case.

    Ronnie

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    because when you create the table you have to specify thaT it supports delete cascade

  3. #3
    Join Date
    Mar 2001
    Location
    New York , New York
    Posts
    577
    How do i do that.

    where can i find more inforation on that.

    Thanks
    Ronnie

  4. #4
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,014
    You need to add the delete cascade on the foreign key not the table.

    ALTER TABLE childtable
    ADD ( FOREIGN KEY (pkey)
    REFERENCES myparenttable
    ON DELETE CASCADE ) ;

    so every foreign key needs the on delete cascade.

Posting Permissions

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



Click Here to Expand Forum to Full Width