I need to add a foreign key constraint but initially it should be disabled. I can add it in create table
sentence or in an alter table
sentence, it does not matter. I do not know the reason behind this request (it may be ORA-02298: cannot validate (BLA.BLA_FK) - parent keys not found
) but I was asked to do it this way. So what is the correct sentence for this in Oracle database?
You'd want to do something like
ALTER TABLE YOUR_TABLE
ADD CONSTRAINT YOUR_TABLE_FK1
FOREIGN KEY (COLUMN1, COLUMN2) REFERENCES SOME_OTHER_TABLE (COLUMN1, COLUMN2)
DISABLE
NOVALIDATE;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With