Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004

    Unanswered: delete from multiple tables

    I'm new to oracle. I have three tables. I want to delete any record(s) from these three tables where user_id = 98

    How can I do this in oracle?

    Would this work??

    delete from table1, table2, table3 where title_id = 98

    Thank you!

  2. #2
    Join Date
    Apr 2003
    Greenville, SC (USA)
    if title_id is a candidate for a primary key in table 1,
    create foreign keys with cascade delete on table 2 and table 3
    referencing title_id in table 1...

    Delete from table 1 where title_id = 'xxx';

    Rows in table 2 and table 3 will also be deleted...

    Another option ...
    delete trigger on table 1 for each row
    delete from table 2 where title_id = ld.title_id
    delete from table 3 where title_id = ld.title_id


Posting Permissions

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