/*order 502237*/
    
      /*
      CHANGE REPORT for Table PRODUCT
          - Adding a new relationship PROD_DEFAULTSALESGRADE_ID
          WARNING : Create FK statement may fail (existing data may violate the new FK rules: adding a new FK PROD_DEFAULTSALESGRADE_ID of table PRODUCT, which references table QUALITYGRADE).
           - Adding column PERCENTAGEFIRSTDELIVERY
          - Adding column DEFAULTSALESGRADE_ID
          - Adding column DEFAULTMOUNTINGGRADE_ID
      ACTION is ALTER or modify Table PRODUCT
      */

ALTER TABLE PRODUCT ADD (PERCENTAGEFIRSTDELIVERY NUMBER DEFAULT 100 NOT NULL
                                   CONSTRAINT PercFirstDel_valid2
                                          CHECK (PERCENTAGEFIRSTDELIVERY 
    BETWEEN 1 AND 100));


ALTER TABLE PRODUCT ADD (DEFAULTSALESGRADE_ID NUMBER NULL);


ALTER TABLE PRODUCT ADD (DEFAULTMOUNTINGGRADE_ID NUMBER NULL);


ALTER TABLE PRODUCT
       ADD  ( CONSTRAINT PROD_DEFAULTMOUNTINGGRADE_ID
              FOREIGN KEY (DEFAULTMOUNTINGGRADE_ID)
                             REFERENCES QUALITYGRADE ) ;


ALTER TABLE PRODUCT
       ADD  ( CONSTRAINT PROD_DEFAULTSALESGRADE_ID
              FOREIGN KEY (DEFAULTSALESGRADE_ID)
                             REFERENCES QUALITYGRADE ) ;

