CREATE TABLE ITEMQUESTIONARIO (
  NRITEMQUEST NUMBER(10) NOT NULL, 
  NRQUESTIONARIO NUMBER(10) NOT NULL, 
  NRQUESTAO NUMBER(10) NOT NULL, 
  NRORDEMQUESTAO VARCHAR2(100) NOT NULL, 
  NRORG NUMBER(10) DEFAULT 1 NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 'S' NOT NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_ITEMQUESTIONARIO PRIMARY KEY(NRITEMQUEST, NRORG)
)
/
ALTER TABLE ITEMQUESTIONARIO ADD CONSTRAINT FKMYM00627QUESTIONARIO FOREIGN KEY (NRQUESTIONARIO, NRORG) REFERENCES QUESTIONARIO (NRQUESTIONARIO, NRORG)
/
ALTER TABLE ITEMQUESTIONARIO ADD CONSTRAINT FKMYM00628QUESTAO FOREIGN KEY (NRQUESTAO, NRORG) REFERENCES QUESTAO (NRQUESTAO, NRORG)
/
ALTER TABLE ITEMQUESTIONARIO ADD CONSTRAINT CKC_IDATIVO_ITEMQUESTIONARIO CHECK (IDATIVO IN ('S','N'))
/
CREATE INDEX MYM00627_FK ON ITEMQUESTIONARIO (NRQUESTIONARIO, NRORG)
/
CREATE INDEX MYM00628_FK ON ITEMQUESTIONARIO (NRQUESTAO, NRORG)