CREATE TABLE CP_CUSTOMER_PREFERENCES (
  ID                 	NUMBER 		   NOT NULL,
  CDCLIENTE  	        VARCHAR2(21)   NOT NULL,
  FILTER_ID    		    VARCHAR2(255),
  LAYOUT_ID    		    VARCHAR2(255),
  VIEW_ID    		    VARCHAR2(255),
  NRORG          		NUMBER  	   DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
  NRORGINCLUSAO  		NUMBER 	 	   DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
  NRORGULTATU    		NUMBER 	       DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
  DTINCLUSAO     		DATE,
  DTULTATU       		DATE,
  CDOPERINCLUSAO 		VARCHAR2(12),
  CDOPERULTATU   		VARCHAR2(12),
  IDATIVO        		VARCHAR2(1)    DEFAULT 'S' NOT NULL,
	CONSTRAINT PK_CP_CUSTOMER_PREFERENCES   PRIMARY KEY(ID),
	CONSTRAINT CKC_IDATIVO_CP_CUSTOMER_PREF CHECK (IDATIVO IN ('S', 'N')),
    CONSTRAINT FK_CLIENTE_CP_CUSTOMER_PREF  FOREIGN KEY (CDCLIENTE) REFERENCES CLIENTE (CDCLIENTE)
)
/
ALTER TABLE OM_ATUALIZACAO_ESTRUTURA ADD DTAGENDATUEST DATE
/
ALTER TABLE OM_ATUALIZACAO_ESTRUTURA ADD IDAGENDATUEST VARCHAR2(1) DEFAULT 'N' NOT NULL
/
ALTER TABLE OM_ATUALIZACAO_ESTRUTURA ADD CONSTRAINT IDAGEND_OM_ATU_EST CHECK (IDAGENDATUEST IN ('S', 'N'))
/