DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: truncate problem

  1. #1
    Join Date
    Jun 2001
    Posts
    28

    SQL> truncate table mmi_t_issue_items;
    truncate table mmi_t_issue_items
    *
    ERROR at line 1:
    ORA-02266: unique/primary keys in table referenced by enabled foreign keys


    SQL> delete from mmi_t_issue_items;

    9 rows deleted.

    SQL>
    Why this happens ?,I think delte and truncate should work in same way as far as references are considered.if anybody can explain me.
    Thanks in advance.

  2. #2
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    DELETE is a DML statement whereas TRUNCATE is a DDL statement.

    If an integrity constraint referencing a table is enabled and you want to delete rows from the table, Oracle checks each row for children in referencing table(s).

    If you want to truncate the table, Oracle just checks for enabled constraints referencing that table and if they exist, statement fails.

    TRUNCATE is something like DROP & CREATE, not DELETE.

    For the best info see http://tahiti.oracle.com/pls/tahiti/...?section=74617
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  3. #3
    Join Date
    Jun 2001
    Posts
    28

    Thanks

    Thanks a lot

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