CREATE TABLE GRUPTIPOCARD
(
    CDGRUPTIPOCARD    VARCHAR2(4)     NOT NULL,
    CDFILCENTPME      VARCHAR2(4)     NOT NULL,
    NMGRUPTIPOCARD 	  VARCHAR2(50)    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',
		CONSTRAINT CKC_IDATIVO_GRUPTIPOCARD CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_GRUPTIPOCARD  PRIMARY KEY (CDGRUPTIPOCARD, CDFILCENTPME)
)
/

ALTER TABLE TIPOCARD ADD CDGRUPTIPOCARD VARCHAR2(4) NULL
/

CREATE TABLE LISTA_DTCARDIAPME 
(
	NRLISTA           VARCHAR2(10)    NOT NULL,
	DTCARDIAPME       DATE            NOT NULL,
	DTCARDIADESTPME   DATE            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',
		CONSTRAINT CKC_IDATIVO_LISTA_DTCARDIAPME CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_LISTA_DTCARDIAPME PRIMARY KEY (NRLISTA, DTCARDIAPME, DTCARDIADESTPME)
)
/