      
      /*
      CHANGE REPORT for Table PRODUCT
          - Adding a new relationship PROD_DEFAULTRETURNGRADE_ID
          WARNING : Create FK statement may fail (existing data may violate the new FK rules: adding a new FK PROD_DEFAULTRETURNGRADE_ID of table PRODUCT, which references table QUALITYGRADE).
          - Adding a new relationship PROD_IMAGE_ID
          WARNING : Create FK statement may fail (existing data may violate the new FK rules: adding a new FK PROD_IMAGE_ID of table PRODUCT, which references table IMAGE).
      ACTION is ALTER or modify Table PRODUCT
      */

begin
execute immediate ('ALTER TABLE IMAGE
       ADD  ( CONSTRAINT XPKIMAGE PRIMARY KEY (IMAGE_ID) ) ') ;
exception when others then null;
end;
/

ALTER TABLE PRODUCT
       ADD  ( CONSTRAINT PROD_DEFAULTRETURNGRADE_ID
              FOREIGN KEY (DEFAULTRETURNGRADE_ID)
                             REFERENCES QUALITYGRADE ) ;
begin
execute immediate ('ALTER TABLE PRODUCT
       ADD  ( CONSTRAINT PROD_IMAGE_ID
              FOREIGN KEY (IMAGE_ID)
                             REFERENCES IMAGE )  ') ;
exception when others then null;
end;
/

 

