ALTER TABLE PARAMIMPPEDIDO ADD IDUTRELACPRODSC VARCHAR2(01) DEFAULT 'N' 
	CONSTRAINT CKC_IDUTRELACPRODSC_PARAMIMPP CHECK (IDUTRELACPRODSC IN ('S','N'))
/

CREATE TABLE RELACPRODIMPSC
(
  CDPRODORIG 		VARCHAR2(10),
  CDPRODIMPO 		VARCHAR2(10),
		CONSTRAINT PK_RELACPROIMPSC PRIMARY KEY (CDPRODORIG, CDPRODIMPO),
  NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
  IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
		CONSTRAINT CKC_IDATIVO_RELACPRODIMPSC CHECK (IDATIVO IN ('S','N')),
  DTINCLUSAO        DATE                  			NULL,
  DTULTATU          DATE                  			NULL,
  NRORGINCLUSAO     NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
  CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 		NULL,
  NRORGULTATU       NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
  CDOPERULTATU      VARCHAR2(12)    DEFAULT '1'
)
/

CREATE INDEX PED00443_FK ON RELACPRODIMPSC(CDPRODORIG ASC)
/

ALTER TABLE RELACPRODIMPSC
  ADD CONSTRAINT FKPED00443RELPRSC FOREIGN KEY(CDPRODORIG)
REFERENCES PRODUTO(CDPRODUTO) ON DELETE CASCADE
/

CREATE INDEX PED00444_FK ON RELACPRODIMPSC(CDPRODIMPO ASC)
/

ALTER TABLE RELACPRODIMPSC
  ADD CONSTRAINT FKPED00444RELPRSC FOREIGN KEY(CDPRODIMPO)
REFERENCES PRODUTO(CDPRODUTO) ON DELETE CASCADE
/