Oracle Delete Cascade ?

Discussion in 'Databases' started by -jay-, Jul 30, 2010.

  1. #1
    Hi, can someone give me a hand.
    have oracle db.

    Have 750 tables.
    Trying to delete about 200 records from a table and get the -
    ERROR at line 1:
    ORA-02292: integrity constraint (bla bla bla) violated - child record found error.

    Foriegn key is user_id in another table, I found table and tried to delete, got error again

    ERROR at line 1:
    ORA-02292: integrity constraint (bla bla bla) violated - child record found error.

    This could go on and on down hundreds of tables.
    Is Delete Cascade an option ?
    Can someone show me how to use this correctly ?
    Sql below - this is the main table that i need to remove the data from.


    DELETE FROM p_master
    where user_id IN (
    '843',
    '999',
    '1000',
    '1037')
     
    -jay-, Jul 30, 2010 IP
  2. Amitoops

    Amitoops Well-Known Member

    Messages:
    1,388
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    148
    #2
    for what you asking for,i am not getting you.have you any problem with it.chek with your created table.
     
    Amitoops, Aug 2, 2010 IP
  3. manimaran

    manimaran Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If I am not wrong, your problem
    Table 1 -> Table 2
    Table 2 -> Table 3
    Table 3 -> Table 4 and so on

    If you try to delete from Table 1 , you are getting child record found error, because there is some reference entries in Table 2

    So you tried to delete from Table 2 , but you are getting child record found error, because there is some reference entries in Table 3 and so on.

    If the above situation is true, try to disable all constraints (if it is Not production environment) and delete. Enable all constraints once you have deleted.

    You can find some useful scripts to find primary reference key:
    http://oracle-faq-qa.blogspot.com/2010/04/useful-scripts-collection.html
     
    manimaran, Sep 15, 2010 IP
  4. Infoway Live

    Infoway Live Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Infoway Live, Sep 20, 2010 IP