/*order 502375*/      
      /*
      ACTION is CREATE Table PLANTFLAGOPTIONS
      */

CREATE TABLE PLANTFLAGOPTIONS (
       PLANT_ID             NUMBER NOT NULL,
       FLAG_ID              NUMBER NOT NULL,
       DIALOG_ID            NUMBER NOT NULL,
       SHOW                 VARCHAR2(1) DEFAULT 'N' NOT NULL
                                   CONSTRAINT YN_ValidationNew156
                                          CHECK (SHOW IN ('Y', 'N')),
       REMOVE               VARCHAR2(1) DEFAULT 'N' NOT NULL
                                   CONSTRAINT YN_ValidationNew157
                                          CHECK (REMOVE IN ('Y', 'N')),
       SELECTABLE           VARCHAR2(1) DEFAULT 'N' NOT NULL
                                   CONSTRAINT YN_ValidationNew158
                                          CHECK (SELECTABLE IN ('Y', 'N')),
       CONFIRM              VARCHAR2(1) DEFAULT 'N' NOT NULL
                                   CONSTRAINT YN_ValidationNew159
                                          CHECK (CONFIRM IN ('Y', 'N')),
       ASKACCEPT            VARCHAR2(1) DEFAULT 'N' NOT NULL
                                   CONSTRAINT YN_ValidationNew160
                                          CHECK (ASKACCEPT IN ('Y', 'N')),
       SYSTEMUSER_ID        NUMBER NOT NULL,
       TIMESTAMP            DATE NOT NULL
);

CREATE INDEX XIF1PLANTFLAGOPTIONS ON PLANTFLAGOPTIONS
(
       PLANT_ID                       ASC
);

CREATE INDEX XIF2PLANTFLAGOPTIONS ON PLANTFLAGOPTIONS
(
       FLAG_ID                        ASC
);

CREATE INDEX XIF3PLANTFLAGOPTIONS ON PLANTFLAGOPTIONS
(
       DIALOG_ID                      ASC
);


ALTER TABLE PLANTFLAGOPTIONS
       ADD  ( CONSTRAINT XPKPLANTFLAGOPTIONS PRIMARY KEY (PLANT_ID, 
              FLAG_ID, DIALOG_ID) ) ;


ALTER TABLE PLANTFLAGOPTIONS
       ADD  ( CONSTRAINT PLANTFLAGOPTIONS_DIALOG_ID
              FOREIGN KEY (DIALOG_ID)
                             REFERENCES DIALOGS ) ;


ALTER TABLE PLANTFLAGOPTIONS
       ADD  ( CONSTRAINT PLANTFLAGOPTIONS_FLAG_ID
              FOREIGN KEY (FLAG_ID)
                             REFERENCES FLAG
                             ON DELETE CASCADE ) ;


ALTER TABLE PLANTFLAGOPTIONS
       ADD  ( CONSTRAINT PLANTFLAGOPTIONS_PLANT_ID
              FOREIGN KEY (PLANT_ID)
                             REFERENCES PLANT
                             ON DELETE CASCADE ) ;



