create foreign key
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: create foreign key

  1. #1
    Join Date
    Nov 2000
    Posts
    245

    I try to create a foreign constraint on a table but the data
    of the table is "bad". so how can I "disable" the constraint when I create it.

    thansk in advance

  2. #2
    Join Date
    Nov 2000
    Posts
    344
    Just add the word 'disable' as the last thing
    before your semi-colon or '/' in your command
    to create the constraint.

  3. #3
    Join Date
    Nov 2000
    Posts
    245

    do I have to enable later? (even with bad records)

    thanks

  4. #4
    Join Date
    Nov 2000
    Posts
    245
    sorry, my quesiton should be:

    how I enable the constriant without correct those bad records

    thanks

  5. #5
    Join Date
    Nov 2000
    Posts
    344
    I think you can say

    alter constraint .... enable novalidate;

    to make it only check for rows you will add in the future
    and ignore rows that are there already. I have never
    tried this though so I could be wrong about it. Just look
    in the oracle documentation in the SQL reference section
    under 'alter constraint'.

    -John

  6. #6
    Join Date
    Nov 2000
    Posts
    245

    thanks, I got the syntax and it works:

    alter table tblname enable novalidate CONSTRAINT constname;


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