CREATE TABLE OM_CLIENTE_CUSTOMIZACAO (
    ID                NUMBER 		  NOT NULL,
    CDCLIENTE         VARCHAR2(21) 	  NOT NULL,
    NRORG             NUMBER 	      DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
    DTINCLUSAO        DATE            DEFAULT SYSDATE,
    DTULTATU          DATE            DEFAULT SYSDATE,
    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'
)
/
ALTER TABLE OM_CLIENTE_CUSTOMIZACAO ADD CONSTRAINT PK_OM_CLIENTE_CUSTOMIZACAO PRIMARY KEY (ID)
/
ALTER TABLE OM_CLIENTE_CUSTOMIZACAO 
  ADD CONSTRAINT FKOMCLIENTE_OM_CLI_CUSTOM FOREIGN KEY (CDCLIENTE)
      REFERENCES CLIENTE (CDCLIENTE)
/
CREATE INDEX FKOMCLIENTECLICUSTOM_FK ON OM_CLIENTE_CUSTOMIZACAO (CDCLIENTE)
/
ALTER TABLE OM_CLIENTE_CUSTOMIZACAO ADD CONSTRAINT CKC_IDATIVO_OM_CLI_CUSTOM CHECK (IDATIVO IN ('S', 'N'))